我目前正在尝试创建网站的自定义标题。它看起来如下:
因此,我使用的是Bootstrap3和Django CMS。它看起来几乎就像我想要的那样,但是,菜单应该与底部正方形在同一条线上。我怎样才能做到这一点?代码如下:
<nav class="navbar navbar-default navbar-fixed-top" style="background-color: white;" role="navigation">
<div class="row" style="height: 35.35px; margin-bottom: 0.5%;">
<div class="col-xs-1"></div>
<div class="col-xs-10"><div class="square"></div></div>
<div class="col-xs-1"></div>
</div>
<div class="row" style="height: 35.35px; margin-bottom: 0.5%;">
<div class="col-xs-1 blue-bar"></div>
<div class="col-xs-10">
<div class="square"></div>
</div>
<div class="col-xs-1 blue-bar"></div>
</div>
<div class="row" style="height: 35.35px; margin-bottom: 0.5%;">
<div class="col-xs-1"></div>
<div class="col-xs-10">
<div class="square"></div>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</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 navbar-right">
{% show_menu 0 100 100 100 %}
</ul>
</div>
</div>
<div class="col-xs-1"></div>
</div>
</nav>
额外奖励:如何在靠近中间广场的位置实现蓝色条形图?
答案 0 :(得分:0)
因此,有几种方法可以修改它(例如,您不需要第一行中的第一个或最后一个col-xs-1
- 您可以在col-xs-10 col-xs-push-1
内放置方块)。
但是尽可能少地修改原始代码,这应该可行:
<nav class="navbar navbar-default navbar-fixed-top" style="background-color: white;" role="navigation">
<div class="row" style="height: 35.35px; margin-bottom: 0.5%;">
<div class="col-xs-1"></div>
<div class="col-xs-10"><div class="square"></div></div>
<div class="col-xs-1"></div>
</div>
<div class="row" style="height: 35.35px; margin-bottom: 0.5%;">
<div class="col-xs-1 blue-bar"></div>
<div class="col-xs-10">
<div class="square"></div>
</div>
<div class="col-xs-1 blue-bar"></div>
</div>
<div class="row" style="height: 35.35px; margin-bottom: 0.5%;">
<div class="col-xs-1"></div>
<div class="col-xs-1">
<div class="square"></div>
</div>
<div class="col-xs-9">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</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 navbar-right">
{% show_menu 0 100 100 100 %}
</ul>
</div>
</div>
<div class="col-xs-1"></div>
</div>
</nav>
这会将菜单项和方块放在同一行的不同列上,因此它们应该并排。
希望有所帮助!