html - 使用 Bootstrap 导航栏固定左右宽度布局

标签 html css twitter-bootstrap twitter-bootstrap-3

我们如何创建一个如下所示的导航栏,其左侧为 300px,右侧为 300px,中心宽度为 100%。我们如何使用 Bootstrap 导航栏实现这种布局。

+-------------------------------------------------------------------------------+
|               |    Center 100% fluid width                       |             
|  SITE LOGO    |------------------------------------------- ----- | Right      +
|               |                                                  |
+-------------------------------------------------------------------------------+

left fixed width —— middle fluid % —— right fixed width

我们如何使用 twitter bootstrap 实现这种类型的布局导航栏。

最佳答案

您可以将左右 div 放在中心 div 中,然后您需要对左右 div 使用 float:leftfloat:right

Live Demo

HTML:

<div class="row">
    <div class="col-lg-12 col-ms-12 col-sm-12 col-xs-12 centerBox">
        <div class="push-left leftBox">left</div>
        this is center
        <div class="push-right rightBox">right</div>
    </div>
</div>

CSS:

.centerBox {  height:50px; }
.rightBox{ width:100px; height:50px; float:right }
.leftBox{ width:100px; height:50px; float:left }

关于html - 使用 Bootstrap 导航栏固定左右宽度布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24715996/

相关文章:

html - 缩小屏幕尺寸并按下按钮后居中对齐导航栏

html - materializecss 移动导航栏被禁用

html - 如何将 mat-button 与 mat-input 对齐?

html - iFrame 最佳实践

javascript - 不使用 'table'创建动态html表

javascript - jquery制作放大缩小文字的按钮

html - 如何根据设备视口(viewport)在 Bootstrap 中将按钮从垂直对齐到水平?

css - Bootstrap 移动优先和媒体查询分组

javascript - 使用 javascript 和 HTML 的动态树结构

html - Django 模板全宽 CSS