1
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
8
6
6
12

The default grid system provided as part of Bootstrap is a 940px-wide, 12-column grid.

It also has four responsive variations for various devices and resolutions: phone, tablet portrait, table landscape and small desktops, and large widescreen desktops.

<div class="row">
  <div class="span4">...</div>
  <div class="span8">...</div>
</div>

As shown here, a basic layout can be created with two "columns," each spanning a number of the 12 foundational columns we defined as part of our grid system.


Offsetting columns

4
4 offset 4
3 offset 3
3 offset 3
8 offset 4
<div class="row">
  <div class="span4">...</div>
  <div class="span4 offset4">...</div>
</div>

Nesting columns

With the static (non-fluid) grid system in Bootstrap, nesting is easy. To nest your content, just add a new .row and set of .span* columns within an existing .span* column.

Example

Nested rows should include a set of columns that add up to the number of columns of it's parent. For example, two nested .span3 columns should be placed within a .span6.

Level 1 of column
Level 2
Level 2
<div class="row">
  <div class="span12">
    Level 1 of column
    <div class="row">
      <div class="span6">Level 2</div>
      <div class="span6">Level 2</div>
    </div>
  </div>
</div>

Fluid columns

1
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
8
6
6
12

Percents, not pixels

The fluid grid system uses percents for column widths instead of fixed pixels. It also has the same responsive variations as our fixed grid system, ensuring proper proportions for key screen resolutions and devices.

Fluid rows

Make any row fluid simply by changing .row to .row-fluid. The columns stay the exact same, making it super straightforward to flip between fixed and fluid layouts.

Markup

<div class="row-fluid">
  <div class="span4">...</div>
  <div class="span8">...</div>
</div>

Fluid nesting

Nesting with fluid grids is a bit different: the number of nested columns doesn't need to match the parent. Instead, your columns are reset at each level because each row takes up 100% of the parent column.

Fluid 12
Fluid 6
Fluid 6
<div class="row-fluid">
  <div class="span12">
    Level 1 of column
    <div class="row-fluid">
      <div class="span6">Level 2</div>
      <div class="span6">Level 2</div>
    </div>
  </div>
</div>
Variable Default value Description
@gridColumns 12 Number of columns
@gridColumnWidth 60px Width of each column
@gridGutterWidth 20px Negative space between columns
@siteWidth Computed sum of all columns and gutters Counts number of columns and gutters to set width of the .container-fixed() mixin

Variables in LESS

Built into Bootstrap are a handful of variables for customizing the default 940px grid system, documented above. All variables for the grid are stored in variables.less.

How to customize

Modifying the grid means changing the three @grid* variables and recompiling Bootstrap. Change the grid variables in variables.less and use one of the four ways documented to recompile. If you're adding more columns, be sure to add the CSS for those in grid.less.

Staying responsive

Customization of the grid only works at the default level, the 940px grid. To maintain the responsive aspects of Bootstrap, you'll also have to customize the grids in responsive.less.

Fixed layout

The default and simple 940px-wide, centered layout for just about any website or page provided by a single <div class="container">.

<body>
  <div class="container">
    ...
  </div>
</body>

Fluid layout

<div class="container-fluid"> gives flexible page structure, min- and max-widths, and a left-hand sidebar. It's great for apps and docs.

<div class="container-fluid">
  <div class="row-fluid">
    <div class="span2">
      <!--Sidebar content-->
    </div>
    <div class="span10">
      <!--Body content-->
    </div>
  </div>
</div>

Responsive devices

What they do

Media queries allow for custom CSS based on a number of conditions—ratios, widths, display type, etc—but usually focuses around min-width and max-width.

  • Modify the width of column in our grid
  • Stack elements instead of float wherever necessary
  • Resize headings and text to be more appropriate for devices

Use media queries responsibly and only as a start to your mobile audiences. For larger projects, do consider dedicated code bases and not layers of media queries.

Supported devices

Bootstrap supports a handful of media queries in a single file to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:

Label Layout width Column width Gutter width
Smartphones 480px and below Fluid columns, no fixed widths
Smartphones to tablets 767px and below Fluid columns, no fixed widths
Portrait tablets 768px and above 42px 20px
Default 980px and up 60px 20px
Large display 1200px and up 70px 30px

Requires meta tag

To ensure devices display responsive pages properly, include the viewport meta tag.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Using the media queries

Bootstrap doesn't automatically include these media queries, but understanding and adding them is very easy and requires minimal setup. You have a few options for including the responsive features of Bootstrap:

  1. Use the compiled responsive version, bootstrap-responsive.css
  2. Add @import "responsive.less" and recompile Bootstrap
  3. Modify and recompile responsive.less as a separate file

Why not just include it? Truth be told, not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it.

// Landscape phones and down
@media (max-width: 480px) { ... }
// Landscape phone to portrait tablet
@media (max-width: 768px) { ... }
// Portrait tablet to landscape and desktop
@media (min-width: 768px) and (max-width: 980px) { ... }
// Large desktop
@media (min-width: 1200px) { .. }

Responsive utility classes

What are they

For faster mobile-friendly development, use these basic utility classes for showing and hidding content by device.

When to use

Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation.

For example, you might show a <select> element for nav on mobile layouts, but not on tablets or desktops.

Support classes

Shown here is a table of the classes we support and their effect on a given media query layout (labeled by device). They can be found in responsive.less.

Class Phones 480px and below Tablets 767px and below Desktops 768px and above
.visible-phone Visible
.visible-tablet Visible
.visible-desktop Visible
.hidden-phone Visible Visible
.hidden-tablet Visible Visible
.hidden-desktop Visible Visible

Test case

Resize your browser or load on different devices to test the above clases.

Visible on...

  • Phone✔ Phone
  • Tablet✔ Tablet
  • Desktop✔ Desktop

Hidden on...

  • Phone✔ Phone
  • Tablet✔ Tablet
  • Desktop✔ Desktop
南通网站优化edm营销平台的费用信息安全公益课程营销总裁班深圳h5网站公司铁岭网站建设信息安全专业认证网络营销是什么济南专业做网站杭州市网络安全西安企业网站建设一个小气朋友的故事穿越洪武年间,身为凤阳县令的岳麟,竟被权相胡惟庸弹劾贪污! 皇帝大怒,微服私访,被当做“暴发户”的老朱,自然得到了岳麟的亲切接待。 “这是后膛枪,买了它,北元鞑虏灰飞烟灭,任谁都要给你几分薄面!” “这是工艺坊,十岁小孩弹溜溜,百岁老人盘核桃,出口一本万利!” “这是福利院,老有所依,幼有所养,以后儿孙不孝,免费入住!” 岳麟只觉得,暴发户老朱身后的几个青年,看他的眼神之中充满杀气。 “奉天承运,皇帝诏,曰:岳麟奉旨贪污,为我大明富国强兵!” 我们的世界是否有那不为人知的一面。 黑暗的城市里传来咔呲咔呲声。 像是某些动物在啃食着骨头。 天空上的一轮血月,赫然无比。 一位少年持刀而立。 他衣不蔽体,周围几人的身上也只剩下了单薄的衣裳。 他不禁喃喃道:“再用这把武器我就是狗!” …… 算了,狗就狗吧,汪汪汪!秦风被迫从游戏界龙头企业辞职后,加入了一家只有几个人的小公司。 制作游戏,我秦风还没服过谁。 看不起小游戏?《开心消消乐》《神庙逃亡》教你做人。 单机游戏没落了?仙剑系列,魂系游戏,剧情或难度,总有一款玩哭你。 网游模式单一?LOL,绝地求生,自走棋,这回不是打怪升级了吧? 就凭做游戏,也能做首富! 不信?做给你看!系统傍身,杀一人,活一天; “以死神的名义,你必须死!” “以死神的名义,毁灭他们!” 死神:“呃...你不要坏我名声!”现代青年张无忌一次考古中,意外发现一座古墓。在古墓的神奇力量之下,竟来到了倚天之中的元朝末世。身怀北冥神功,逍遥传承,且看他如何在这个世界掀起风云,红颜相伴,兄弟相随,开辟出一个煌煌盛世! 注:本书单女主,不喜勿入!广袤3的玛法大陆天空出现异变,古老的遗迹和禁地随之发生躁动,神秘的天选者降临,这次会有什么不同吗?这次会改变界域战场人族和魔族的战争吗?(纪念那逝去的兄弟,纪念那些年的燃情岁月。)本书又名【大明:我人皇的身份被女帝曝光】。 绝世凶人朱厌,穿越到历史爽文《大明劫》中,成为存在感微弱的配角。 他本想安稳度日,跟着书中主角团队吃香的喝辣的,结果被迫绑定系统,拯救濒临毁灭的大明皇朝。 狗作者……你干得是人事儿吗?挖坑不填我就不说了,居然还太监? 现在轮到这些坑都要我解决……你妹!!!拥有灭魔血脉的木子余在十六岁觉醒了灭魔血脉之力,从此告别了平凡人生,更因为一次意外,掉落山崖,获得了不死天功传承,打开了更为广阔的一片天地。灵气复苏,山海真祖镇压当世一切敌,时过千年,高中生王毅背负山海经,是宿命,还是使命?
企业网络营销运营方案 东莞seo网站优化 app设计网站 重庆綦江网站制作公司电话 app设计网站 网站建设前准备 办公网络安全建设 日本国家信息安全战略 网站的费用 复旦 信息安全 网络公司网站建设 中企动力技术支持网站 朝阳企业网站建设 edm营销平台的费用 手机行业的网络营销 河东做网站 徐州网站二次开发 厦门 做网站 信息安全相关竞赛 沈阳教做网站 上海客服营销外包 网络营销策划经理 高校网络安全小组有哪些网络安全团队招人? 网站响应式和非响应式 互联网营销书籍 网络安全属性和攻击的基本模式 网络营销是什么 深圳做网络安全公司排名 在百度上建网站 最优秀的佛山网站建设 网站系统建站 app设计网站 网站建设前准备 河南信息安全公司 网络营销未来趋势 网站备案不通过怎么解决 宜昌做网站 学校网站建设哪家好 关于加强网络安全有何意义 网络营销整体运营方案 公司网站的制作公司 营销网站建设企划案例 全网整合营销企业 国内网站设计经典案例 徐州网站二次开发 杭州市网络安全 网络安全 csdn 河东做网站 在百度上建网站 搜索引擎内容营销案例 学校网站建设哪家好 网站制作案例 国家网络与信息安全通报机制 具有品牌的广州做网站 成都 网站设计公司 网站的费用 营销免费 公司网络营销的方案 企业网络营销运营方案 网站设计的评估 西安企业网站建设 网络安全法官网 手机行业的网络营销 成都 网站设计公司 徐州网站二次开发 软营销网 北京启明星信息安全技术有限公司 铁岭网站建设 信息安全审计 市场发展 网络安全包含哪5个 甘肃网站建设公司 学校网站制作 传统市场营销理论 上海客服营销外包 网站制作案例 网站url 重庆綦江网站制作公司电话 常用的信息安全防护方法 网络营销发展课完整版 企业网站的类型 如何维护网站 网站页面 办公室信息安全工作职责,-1 宜昌做网站 全屏网站 密码技术网络安全公司 东台网站建设 北京b2c网站制作 网络公司网站建设 网站建设前准备 烟台网站制作 网络安全数据分析 网络安全数据分析 网络营销发展课完整版 网络营销与策划培训 东台网站建设 如何新建自己的网站 锦州网站建设 信息安全专业领军人物 网络安全年检信息表 评测依据的行业标准名称网站模板和定制的区别 网站上传文件功能实现 魔兽世界 网络安全任务 办公网络安全建设 成都网络安全技术公司 学校网站制作 电商网站前台模块 宜昌做网站 企业信息安全介绍 关于加强网络安全有何意义 衡水专业网站建设公司 php网站培训 婚庆网站建设 空间营销 北京启明星信息安全技术有限公司 员工信息安全培训 2014中国信息安全报告 厦门 做网站 单位信息安全工作的组织领导情况 微信开发网站建设程序 深圳网络营销 网络安全吧 3g网站开发 网络安全漏洞 网络安全编程 网络安全编程 php网站培训 一般网站有哪几部分构成 微信开发网站建设程序 互联网营销的优缺点 业务对信息安全 河南信息安全公司 国家信息安全技术研究中心,-1 做网站实例 中企动力技术支持网站 财务服务器的网络安全 网络营销整体运营方案 十大网络信息安全事件 如何维护网站 网站怎么创建 信息安全 logo 互联网络安全 重庆涪陵网站建设 网站制作公司 深圳 网络安全主要功能 河东做网站