我正在使用bootstrap3设计菜单。它应该看起来像图中所示。但我无法创建这样的菜单。我尝试创建一个,我设计的链接是https://codepen.io/irshad437/pen/EyQLVv。
一些代码也显示如下。 但你必须在Codepen.io上查看(不在这里看好)
<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="#">MyGrade <span class="circle-txt">Up</span></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><a href="#">HOME</a></li>
<hr class="vertical" />
<li><a href="#">EXPLORE</a></li>
</ul>
<form class="navbar-form navbar-right" role="search">
<button type="submit" class="btn btn-default btn-rnd">Create Portfolio</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Anonymous <br />0 pts</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<img class="img-circle nav-img" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/677716/profile/profile-80_1.jpg" alt="?" class="img-round"/>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
.btn-rnd{
border-radius:10px;
}
.navbar-nav li{
margin-left:20px;
margin-right:20px;
}
.nav-img{
width:40px;
height:40px;
}
.vertical{
position:absolute;
width:1px;
height:25px;
color: black;
background-color:black;
display:inline-block;
}
.padding-8{
padding-top:8px;
}
.img-circle{
border: 1px solid black;
}
.circle-txt{
height: 40px;
width: 40px;
display: inline-block;
text-align: center;
vertical-align: -10px;
padding-top:8px;
border-radius: 50%;
background: white;
border-style:solid;
border-width:1px;
}
答案 0 :(得分:1)
这应该可以正常工作,看看,这是修复。
https://codepen.io/anon/pen/QEmZWR
HTML:
<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="#">MyGrade <span class="circle-txt">Up</span></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><a href="#">HOME</a></li>
<hr class="vertical" />
<li><a href="#">EXPLORE</a></li>
</ul>
<form class="navbar-form navbar-right" role="search">
<button type="submit" class="btn btn-default btn-rnd">Create Portfolio</button>
</form>
<ul class="annon nav navbar-nav navbar-right">
<li><a href="#">Anonymous <br />0 pts</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<img class="img-circle nav-img" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/677716/profile/profile-80_1.jpg" alt="?" class="img-round"/>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
&#13;
CSS:
.btn-rnd{
border-radius:10px;
}
.navbar-nav li{
margin-left:20px;
margin-right:20px;
}
.nav-img{
width:40px;
height:40px;
}
.vertical{
position:absolute;
width:1px;
height:25px;
color: black;
background-color:black;
display:inline-block;
}
.padding-8{
padding-top:8px;
}
.img-circle{
border: 1px solid black;
}
.circle-txt{
height: 40px;
width: 40px;
display: inline-block;
text-align: center;
vertical-align: middle;
padding-top:8px;
border-radius: 50%;
background: white;
border-style:solid;
border-width:1px;
}
a{
margin: 0px;
padding: 0px;
}
.navbar-nav li{
margin-top:10px;
}
.navbar-form .btn{
margin-top:10px;
}
.annon li{
margin:0px;
}
.navbar-nav .img-circle{
padding:0xp;
margin-top:13px;
}
&#13;