如何设置CSS设置以显示引导程序.dropdown
和.dropdown-menu
看起来像合并(没有边框),如下图所示的第二个菜单?
.navbar-default .navbar-nav>li>a {
border-bottom: 0px solid #ccc;
}
.navbar-default {}
.dropdown {
border-left: 1px solid transparent;
border-right: 1px solid transparent;
}
.dropdown:hover {
background: white;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 0px solid #fff;
}
.dropdown .dropdown-menu {
border-top: 1px solid #ccc;
z-index: 1;
}
.dropdown .dropdown-menu {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
max-height: 0;
display: block;
overflow: hidden;
opacity: 0;
box-shadow: none;
border-radius: 0px;
}
.dropdown:hover .dropdown-menu {
max-height: 400px;
opacity: 1;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row">
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
</div>
&#13;
答案 0 :(得分:2)
您可以使用DISEASE Gender Age Race Date Freq
Campy F 32 ASIAN 1/6/2014 10
Campy M 52 WHITE 1/2/2014 15
Campy M 63 WHITE 1/3/2014 56
Chlamydia F 24 LATINO 1/8/2014 32
Chlamydia F 32 AA 1/3/2014 52
元素的底部边框以及一些z-index和负边距来使其覆盖菜单上的边框。默认选择器很重,但它可以工作。
您还需要将左侧菜单下拉菜单向左移动以隐藏间隙,右侧下拉菜单向右移动。您可以分别使用a
和translateX(-1px)
来完成此操作。我建议使用转换,因为如果使用边距,似乎会出现动画延迟。
translateX(1px)
.navbar-default .navbar-nav>li>a {
border-bottom: 0px solid #ccc;
}
.navbar-default {}
.dropdown {
border-left: 1px solid transparent;
border-right: 1px solid transparent;
}
.dropdown:hover {
background: white;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 0px solid #fff;
}
.dropdown .dropdown-menu {
border-top: 1px solid #ccc;
z-index: 1;
}
.dropdown .dropdown-menu {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
max-height: 0;
display: block;
overflow: hidden;
opacity: 0;
box-shadow: none;
border-radius: 0px;
}
.dropdown:hover .dropdown-menu {
max-height: 400px;
opacity: 1;
}
/* NEW CSS */
.navbar-default .navbar-nav>li:hover>a {
border-bottom: 1px solid #fff;
margin-bottom: -1px;
z-index: 10;
}
.dropdown-menu {
transform: translateX(-1px);
}
.navbar-right .dropdown-menu {
transform: translateX(1px);
}
答案 1 :(得分:0)
.dropdown .dropdown-menu {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
max-height: 0;
display: block;
overflow: hidden;
opacity: 0;
box-shadow: none;
border-radius: 0px;
border-top: none;
margin-left: -1px;
}
(注意最后两个额外的属性)
答案 2 :(得分:0)
您可以使颜色透明,这样您就不必担心更改间距
.dropdown .dropdown-menu {
border-top: 1px solid transparent;
}
答案 3 :(得分:0)
我的方法包括使用function wrap_videos_with_ads( $html, $url, $attr, $post_id ) {
$ad_above_video = 'PUT YOUR AD CODE HERE';
$ad_below_video = 'PUT YOUR AD CODE HERE';
return $ad_above_video.$html.$ad_below_video;
}
add_filter( 'embed_oembed_html', 'wrap_videos_with_ads', 11, 4 );
为.dropdown添加一个伪元素,并将其放在带有border: 1px solid white;
的.dropdown之上
z-index: 2;
&#13;
.navbar-default .navbar-nav>li>a {
border-bottom: 0px solid #ccc;
}
.navbar-default {}
.dropdown {
border-left: 1px solid transparent;
border-right: 1px solid transparent;
}
.dropdown:hover::after {
content: ''; /* added */
width: 100%; /* added */
position: absolute; /* added */
border-bottom: 1px solid white; /* added */
z-index: 2; /* added */
}
.dropdown:hover {
background: white;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 0px solid #fff;
}
.dropdown .dropdown-menu {
border-top: 1px solid #ccc;
z-index: 1;
}
.dropdown .dropdown-menu {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
max-height: 0;
display: block;
overflow: hidden;
opacity: 0;
box-shadow: none;
border-radius: 0px;
margin-left: -1px;
}
.dropdown:hover .dropdown-menu {
max-height: 400px;
opacity: 1;
}
&#13;