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
网络营销资源合作动力网站衡水网站制作公安部信息安全等级保护评估中心网站备案时间重庆信息安全协中国网络安全峰会网站建设发布打造公司的网站营销的价值英国 网络安全 机构看破风云,风起云涌,修真者被害穿越到武侠世界,众美女如云,长相思伴,看他如何踏破 虚空,称霸武林,独领风骚 。灵异事件,着火了,别人却看不见。只能自己看见(本书又名:掘墓人的亲身经历)我爹说,我的命是借来的,出来借迟早是要还的! 而我的故事,还要从我即将满十八岁的那场经历开始,就让二狗以自己的掘墓人的亲身经历,带领大家解读那些藏于民间的传闻秘事……獬豸不想理你,并向你丢了一个奥利给姜凌天身处娘胎中,听到自己被人扰乱天命,出生会是个没长相,没资质的路人时,激活了无限修改系统! 系统只有一个功能,修改! 体质废柴?修改!叮!获得万古道体! 气运超垃圾?修改!叮!获得诸天万界永生庇护! 功法等级太低了,修改!叮!获得太上混沌道经! 颜值不行?修改!于是,世上多了一位亘古难遇,万古第一的帅哥……人间的无常,俊俏的神灵。 世间律法不及之处,人间黑暗遍布的深渊。 不要唾弃世间的不公,我就是人间最公平的判罚者 天空突变,一次偶然的机会人类发现了比自己还强大的物种,贪婪的妄想却把沉睡千年的丧尸给惊醒了,不思考只听他人的人类征服选择了错误的选项差点毁掉世界,圣鹰小队能否侦破这起危机......无籍小辈,用生活中琐事的汇集,感悟人生,达到人生境界的升华......网球的世界,形形色色的人, 因为网王,我爱上了网球。 若是有可能,你会成为网王里的谁网安圈的菜鸡一枚,没事写点内容造福群友。
网络与信息安全小组 南宁企业网站 手机版网站设计风格 windows 网络安全控制软件 棱镜门 信息安全 ppt 博客营销 blog 棱镜门 信息安全 ppt 网站挂黑链 网络安全公司排行 动力网站 国家网络安全报告 网络安全所涉及的内容商贸公司营销网站建设 邮箱营销案例 动力网站 网站建设公司 深圳 翻墙后自己信息安全吗 广西网信信息安全 招聘,-1 南宁企业网站 广西网信信息安全 招聘,-1 1网络安全防护技术主要包括( ) 加强个人网络安全意识 开发网站需要什么技术 衡水网站制作 网络安全和协议 东莞网站制作 1网络安全防护技术主要包括( ) 南通企业网站制作 营销的价值英国 网络安全 机构 社会大学生网络安全总体数据分析 网络营销以网络用户为中心 上海企业网站优化 信息安全测评备案 网络安全审计联通 信息安全监管要求 全国公安机关网络安全保卫工作会 网站备案时间 银川怎么做网站 网络安全管理实践 网络科技营销 朝阳企业网站建设方案 1网络安全防护技术主要包括( ) 竞价推广公司铭心营销 信息安全cisp 免费网站模板下载 免费网站是 传统营销的公司 创建网站公司 徐州 朝阳企业网站建设方案 博客营销 blog 企业网络安全实现的方案 ips 江苏网络营销推广报价 全网整合营销推广公司 服务厅网络安全管理 网络与信息安全小组 网络营销资源合作 网站设计架构 网络安全哪家好 建国内外网站有什么区别 传统的营销 南昌网站设计单位公司 抄袭的网站 旅游网站设计模板 做网站责任 信息安全技术 路由器安全技术要求营销广告的表现形式 龙岗营销网站建设 网络安全竞赛入口 深圳 企业网站建设 病毒性营销推广方案 如何建设好英文网站 线上营销 微山做网站 网络安全就是信息安全 网站组成费用 网站模板下京东销售部门网络营销系统 病毒性营销推广方案 主流网络安全机制 上海全国网站建设 衡水网站制作 网站建设成本 网络营销资源合作 中国信息安全 杂志 网站建设公司 深圳 windows 网络安全控制软件 银川怎么做网站 网络安全产品培训方案设计 深圳大型网络营销公司 网站建设高端 信息安全系统等级二级 西乡做网站 苹果支付网络安全 网站设计的优点和缺点 大型的网络整合营销 线上营销 开发网站需要什么技术 网站设计架构 做网站设计所遇到的问题 提升网络安全管理水平 深圳 企业网站建设 朝阳区网络安全中心 打造公司的网站 信息安全网址 单位网站建设 xx公司信息安全解决方案 网络信息安全泄露,-1 南宁企业网站 深圳市计算机网络公共网络安全协会 打造公司的网站 东莞网站制作 五金 网络 推广 营销 中国网络安全峰会 中国网络安全峰会 浙江省网络安全中心 2004年国家信息安全专项 网站挂黑链 第二届国家网络安全宣传周主题 网络安全实验班 营销学专家 临汾网站建设 广西网信信息安全 招聘,-1 免费网站模板下载 网络安全屏保 博客营销 blog 社会大学生网络安全总体数据分析 建设营销型网站的要素 东莞网站制作 加强个人网络安全意识 信息安全案例教程:技术与应用 信息安全竞赛官方网站 上海企业网站优化 网络安全面临的主要威胁及解决措施 南昌网站设计单位公司 网络安全产品培训方案设计 传统营销的公司 网站建设套餐 企业网络营销活动方案 绵阳的网站建设公司 信息安全系统等级二级 全国信息安全法规 信息安全测评备案 张家港早晨网站制作 北京昌平网站设计 信息安全监管要求 信息安全iso27001 东莞网站建设报价 苹果支付网络安全