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
云网站系统裁剪图网站网络安全系统开发公司南京新媒体营销培训网站建设管理软件建网站赚钱网络安全产品培训方案设计手机网站建设免费衡水网站建设网络营销策划推广方案营销的由来网店协作与联动营销2016 信息安全 国际网络信息安全通报机制选择佛山网站设计深圳大型网络营销公司排名网络安全运维服务什么是整合营销?高端品牌网站建设网络营销的业务流程网络营销具体指什么区别网络安全运维服务有哪些公司是营销公司公司网站建设总结网站制作 武汉企业网站欣赏网站运营中国网络安全峰会辽宁省网络安全中心河间做网站网络安全系统建设整合营销传播的条件永恒真神经过背叛,重生仙域女帝姬如霜惨遭暗算,自爆而亡。 机缘巧合一缕神魂转世投胎下界仙朝! 复仇大业未行,却发现隔壁居然还有一个男婴。 “哼,不过是长生路上的累赘罢了。” 可接下来,女帝却发现自己的这个弟弟有些变态。 放弃神药灵液,居然让她觉醒轮回道体! 摸摸自己,居然让她修为翻倍! …… 面对哥哥的无限宠爱,女帝则是羞红了脸。 “哼,雕虫小技!” “复仇当前,本帝怎么可能屈服于这个男人的施舍。” “嗯,神药真香!谢谢哥哥!“陈晓穿越大唐贞观初年,继承了家中位于长安东市的酒楼。 哪知那唐皇李世民化名李二哥,成了酒楼的常客。 推杯换盏之余,李世民的问题也越来越奇怪: “陈掌柜,突厥屡屡南下劫掠,可有一劳永逸的办法?” “陈掌柜,蝗灾荼毒天下,朝廷应当如何应对?” “陈掌柜,天下之大,我大唐铁骑如何能雄霸天下?” 陈晓有些头疼,我就一开饭馆的,你总问我这干啥? 关键是,大唐铁骑怎么还真雄霸天下了?做人总得有梦想。我的梦想就是我的榜1。我是一个男神,超级无敌! 我正在上大学,因为天生的神神基因,加上后天的锻炼,浑身上下,便拥有万般的神力。 一个人的力量,可以对付无数的平常之人。 加上,我长相柔美,貌似美丽的女孩子一般。 许多女孩子甫一见到我,就会深深地爱上我。 无论我走到那里,都会遇到情痴痴的女孩子。 女孩子们疯一般,痴痴地纠缠住我,骚扰我,令我烦不胜烦。 我是男神,超级无敌,却无法摆脱女孩子们热烈的纠缠。 哎!男神魅力,超级无敌呀!咸鱼舰长董墨轩意外身亡后来到了崩坏世界,原本想继续自己舰长职责的他却发现自己成为了一名死士。 所以,董墨轩决定………… 我不做人了,女武神们! 我要成为死士王君临天下! 然后………… “哦,是吗?” 看着拿着枪顶着自己女孩,董墨轩不屑的表示………… 不要杀我,我真的是好死士啊啊啊啊啊!!!小时候还不懂得读书写字,便喜欢听姥姥跟我讲她年轻时候的故事。姥姥本来是大地主家的被长辈们宠溺的小女儿,但在那个动乱的年代日本人的入侵打破了原本的一切,姥姥的长辈不管是经商还是入仕都没有一个好的结局,百年的大家族渐渐落魄。姥姥的父亲也因参与地下党打鬼子被抓,很快脑袋便落地了,姥姥7、8岁的年纪就离开了家,成了一位流离失所、躲灾躲难还要坚持读书的女学生。抗日胜利了,姥姥刚回到自己的家乡就要开始崭新的生活,蒋介石政府却在败逃台湾之前将黄河堤坝扒开,一时间水漫金山,姥姥和家人再次沦为了难民,漂泊当中姥姥与自己唯一的姐姐失散,不知是命运安排还是什么,姥姥在尉县的一个小村子里吃上了一顿特别饱的饭并被一个农户家庭收留作为儿媳妇,也就我的姥爷家。新中国成立,姥姥的后半生便停留在了这个小村子,她的故事也和新中国农村乡土的故事交织在了一起......平凡的药童为了揭开自己身世之谜,踏上修真之路。一洛之海,万丈之深,水是命源,洛海之根一个男人的奋斗史,从青春到大叔的蜕变,所有的经历,所有的人和事,都在岁月的漂泊里渐渐沉淀,成长为独立思考的个体!世间的所有都是珍贵,体验过的才最真实。有你有我的影子,在岁月里渐行渐远!
全国信息安全法规 网站设计架构 辽宁省网络安全中心 陕西企业网络营销 网站的总体结构 常州网站建设哪家好 2013网络安全大会 网站营销 沈阳网站 深圳网络安全招聘 网络营销的业务流程 西安高端网站制作公司哪家好 晋中网站建设 苏州 网站制作公司 信息安全专业中国大学排名 裁剪图网站 建网站赚钱 全国信息安全法规 CNISA信息安全大赛 网络安全 dmz 网络营销具体指什么区别 福州网站制 企业网站模板下载 广州外贸营销型网站 衡阳网站建设 南京网络营销外包 网络营销广告形式 东莞网站优化公司 提供商城网站制作 微电商营销策划方案 无锡全网营销外包 网络营销广告形式 衢州做网站 福州网站制 网络营销的基础与实践 佛山手机网站建设优化 开发网站需要什么技术 免费建立网站 网店协作与联动营销 国有企业网络安全