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
南昌 网络营销网络安全审计系统 报价学习网络安全视频营销的应用如何制作营销网站模板网络安全信息测评报告好网站页面开放网络安全网络安全的发展历史网站建设优化定制建网站信息安全专业获批成都微网站电子 东莞网站建设南昌 网络营销网络安全新闻网站江西医疗网站建设排版的网站上海网站优化公司青岛网站建设找党政机关信息安全机构房地产网站制作电子 东莞网站建设公司营销网站制作网络营销引入网络营销师的培训机构工控信息安全我国的信息与网络安全防护能力比较弱网站建设优化网站开发服务公司【灵异、悬疑、惊悚、探险、宠物、系统、游戏、搞笑】 废弃的别墅,消失的山村,黑暗的血楼…… 人头蜘蛛,红衣厉鬼,浑身是手的怪物…… 在这个深夜的恐怖世界里,王尊稳如老狗,遇人先问娘,杀鬼必扬灰,万事只求一个安稳! 别人还恐惧在诡异怪谈中时,王尊在惊悚游戏世界里杀疯了。刘骁穿越到三国,获得无数能让人成仙的精魂。 原以为可以在三国活的逍遥自在,却发现居然很多人都有。 刘骁很淡定,因为他能吞噬精魂。 可是很快他就发现,自己竟然有统一三国的趋势。 诸葛亮的八卦阵变成战舰,司马懿能撒豆成兵。 庞统能呼风唤雨,鲁肃能点石成金,华佗长了一双透视眼。 最恐怖的是司马昭,竟然能听见别人的心声。 刘骁赶紧逢人便解释:“我真的没想统一三国啊!”。哪怕已经过去了很久很久,和平时代早已来临,他依然时常回想过去,回想起那座燃烧着的边境城市,那团火从那时便引燃了少年炽烈的心,如光,如炬,引领无数拥护者追随他的步伐,用铁与血推动了历史的车轮。苏阳遭女朋友背叛,意外融合九阳医神传承,从此医术无双,武功盖世,财源滚滚,各色美女红颜纷至沓来。一个平凡少年步入除魔降妖的道路,一步步踏上轩盏龙炎的驱灵人。记录着关于斯卡德科技世界观及背景,其他的小说可以使用里面的任何设定,任何人都可以使用(需要提前标注),会不定期更新。叶尘 数学天才 奥数冠军,速算流派创始人 一生痴迷数学,打破无数数学纪录,创造无数数学神话! 然而正在他一步步走向人生巅峰时,一场并魔吞噬了他的所有,也让世界失去了一位杰出的数学天才! 弥留之际,叶尘心中仍然心心念念着他的数学研究,尤其是他的速算流! 在一阵极端的痛处中,叶尘的意识开始模糊,神魂游离! 守候在叶尘周围的众人开始放声哭泣 遥远的蓝星遭遇前所未有的危难,于地球寻找帮助,林飞作为第一批灵魂穿梭的人类,他的未来将走向何方。民间口口相传着一个故事: 世间本蕴涵丰富的灵气。修道之人浅则延年益寿,深则飞天遁地、排山倒海,超脱万物之规律。 但在400多年前,一位通天地彻的神秘道人不知算出了何种天机,竟不惜魂飞魄散,道行尽失,也要与“天”抗衡。 自那以后,世间灵气变得十分微弱。虽仍有修道之人,但都修行浅薄。与登仙再无机缘。 18年前,一起发生在龙虎山的“离奇盗墓案”让方介白失去了双亲,但是他坚信自己的父母没有死。 也是自那以后,在这座城市里,不断有着灵异的事件情发生在方介白的身上。 这让一个坚信唯物主义的成年人无法用科学理解这些超自然现象,直到方介白发现......
网站开发服务公司 电子 东莞网站建设 网站制作价格 上海 网络安全感知 网络安全审计系统 报价 营销渠道与营销网络 什么是搜索引擎营销腾讯 哈密网站制作公司-哈密网站建设|哈密网络公司|哈密做网站 上海网站优化公司 哈密网站制作公司-哈密网站建设|哈密网络公司|哈密做网站 8469网站 江西医疗网站建设 信息安全等级保护测评指南 营销咨询服务内容 网络安全感知 全网营销型网站 企业信息安全评价指标 工业控制网络安全事件 网站开发服务公司 2016网络安全大赛 卫士通信息安全技术有限公司 徐州公司网站制作 网站免费注册 廊坊做网站 网站制作价格 上海 网络安全引言 网络安全 ppt 2017 手机销售网站制作 手机网站例子 定制建网站 信息安全的工作原则 排版的网站 公司网站维护 什么是搜索引擎营销腾讯 网络安全应急响应中心 广州网站制作公司 网站信息安全认证中心 常州互联网营销公司 信息安全管理体系建设方案 郑州计算机系网络营销