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
网络安全学院开工信息安全竞赛策划书b2b网络营销的定义高等学校信息安全系列教材·入侵检测技术常州微网站网络营销有证书嘛佛山网站优化衡水网页网站建设上海网站优化公司公司网站建设推广网络营销新方式有哪些电子 东莞网站建设网络营销案例上海网络安全监察部门网络营销建立在创旗信息安全管理系统网站建设优化文章佛山网站推广网络安全的案例题网络营销途径都有哪些科技类网站中国顺德手机网站设计广东信息安全专业大学计算机网络安全的信息信息安全风险评估平台,-1病毒营销的提出台州做网站的公司网络安全日志跟踪诊断网站制作哪家专业网站建设团队小不忍则乱大谋 ,要学会忍耐。 能毫不费力就吃到嘴的食物,不是毒药,就是诱饵;斗勇更要斗智,请用脑子来玩游戏。零号都市,那是一座只存在于档案中的都市。传说它拥有着远超当代的科技,还有着创造超能力者的技术。 而在2022的某一天,整个世界的天空都出现异象,超能力者开始在世界各地涌现,零都以及零都背后的秘密,开始展现在世人面前。兄弟几人修炼保护妹妹(姐姐)的小说 作者第一次写小说有不好的请谅解,也请大家多提提意见齐天大圣重生归来,再战西游什么?赤犬想打我? 小冯啊,立马变成赤犬,拍一套赤犬猛男写真,立马发售! 雷洛斯前辈,赤犬认错了。 小冯,走,再看看谁不服,直接拍落照。 前辈,服了服了,都服了! 大家全部都在门口排队认错呢!【无毒+不圣母+不送女】 宁凡穿越仙侠世界,觉醒分身养成系统。 开局创建四大分身。 只要把分身培养成大佬,他就能获得奖励。 分身的实力越强,奖励就越丰厚。 于是... 太上宗:我宗道子先天道体,有大帝之姿。 宁凡:对不起,他是我的分身。 紫斗仙宗:我宗圣子摘草可斩尽日月星辰。 宁凡:对不起,他也是我分身。 合欢宗:我宗圣女总该不是你的分身了吧! 宁凡:对不起,她是… 罗刹魔宗:除了这句你还能说点其他的吗? 宁凡:其实你们宗主… … 异族女帝:人族的大佬都是同一个人?笑死朕了! 宁凡:你笑啥?你刚过门的相公,也是我的分身。 异族女帝:???狗贼,啥也别说了,拔刀吧!意外穿越大秦,成为八公子嬴子夜,觉醒神级阅读系统,只要读书就变强!只要读书就能获得无限奖励,只要读书便可入圣! 为此,嬴子夜终日闭关读书,兢兢业业,不招灾,不惹祸。 终有一日! 始皇重危,意欲东巡求长生。 墨家蠢蠢欲动。 六国余孽准备造反。 赵高意欲篡改遗诏。 …… 嬴子夜知道,这时候不能继续藏了!再藏大秦不复、自己也将被胡亥杀死! “扮猪吃虎十余年,今日本公子不藏了!” “今日,本公子以读书入圣!一剑斩天!” “传令,三千大雪龙骑军出动!” “传令,铁浮屠出动!” “……” 江小纯穿越成一个胎儿,旁边是重生女帝! “别闹了!” 江小纯无意一脚踹出,竟然调动荒古圣体。 重生一世的鸿天女帝,刚轮回成为婴儿,遇见圣体胞弟,本是心生夺舍,不料被胞弟一脚踹了出去。 不可一世的女帝,直接早产!龙神之子龙熠被留在下界,面对悲惨的命运,龙熠又该如何面对? 云道十七年,经灭国之灾,嘉祈国群龙无首,妖祸丛生,江湖动荡,人人自危,偌大的国土分裂成了无法相互联系的遗留文明。 经此一役, 残余的四位侯爷各据一方,易名为督府,改年号“平正”,各自将这一段过往掩埋于心。以稳定局势,护一方太平。 多年后,五地势力新人换旧人,初心被岁月消磨,其亦心怀鬼胎,野心昭昭。 被遗忘的梦魇逐渐显露,风平浪静的表象下究竟藏着什么呢...... “若这是你的命,我也当同你一赴万死。” “辛泽川,我可等了你好久” 架空文
上海网络安全监察部门 下半年的信息安全会议 城市分站网站设计 网络安全国标 公司网站传图片 网络营销参考书 创新网络营销 访问京东为网站选择5个核心关键词和30个长尾关键词? 网站都是每年续费的吗 深圳市网站设计公司 信息安全工程研究中心有限公司,-1 邮件营销是什么意思 2017网络安全博览会 429网络安全日 百度 网络营销调研的类型 网络营销对应岗位网络安全狗招聘 网络安全集中监控 网络安全身份验证功能有什么用途 网络安全审计产品 什么是互联网新媒体营销策划 文玩营销模式 市场营销网络培训 网络营销参考书 网站欣赏】 网络安全学术论坛 网络对营销策略的影响 电子商务网站建设的概要设计 酒店的网络营销环境 服务器信息安全 规范 信息安全漏洞还原方法 网站建设整合营销 银行信息安全演讲,-1 企业微信营销成功案例 隐藏的网络安全吗 珠海网站建设公司 上海网站优化公司 网络营销怎么收集数据分析 电子商务网站功能页面 酒店的网络营销环境 网络营销怎么收集数据分析