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
防火墙技术在网络安全中的应用网络安全形势严峻信息安全实施计划做网站设计服务商网站网页昆明网站开发营销病毒政安信息安全研究中心美国网站空间微信网站制作顺德建网站的公司正规的搜索引擎营销企业网站建设排版页面加密和解密技术对于信息安全邢台网站制作哪家好工业控制系统信息安全第1部分:评估规范信息安全相关政策法规计算机网络安全实训教程计算机网络安全实训教程全响应网站制作营销病毒企业网站策划方案珠宝网站建商台北病毒营销是什么意思南京营销策划推广公司大连企业网站邮件营销推广有了域名 网站建设邮件营销推广广东网络信息安全基地一个高中毕业的学生,带着一个幸运的锦鲤穿越各种平行世界,在各种平行世界中,他都是最强大的那个人... 晴空破开乌云,象征着胜利的光辉照下,唐一吟的神情空无,手中轻握住脖颈上挂着的项链,脑中的回忆在此刻彻底翻涌而出,忽的他读懂了,那时,那个眼神中的意思。 /:你身后恨意滔天/:你身后背负不属于你的罪责 //:放下吧 /:放下?我也想/:放不下,这是与我相关的历史 //:为什么? //:因为我不能 任凭时间改变一切,世间变换翻转无常 //:我仍爱你,为此不变 唐一吟重新问了一遍,以回忆的形式…… 有人问:“生活的意义是什么?”我说:生活的意义就是不需要去寻找它的“意义”,我们活在这个光怪陆离的世界里,像是星辰大海、繁星点点,而意义就在于:我们,慢慢发光的那一个过程。 还有人问:“那爱情呢,是什么?” 爱情……也许会让你这颗“星”熄灭,但总会出现一个人点亮你的世界。 我叫周东黎,我用我的故事来告诉你,什么是生活,而什么又是爱情。少年被迫顶罪,惨死宗门大比现场。 死后意外摆脱万载诅咒。 被遗弃数万年的星域有圣人踏出,只问诸天仙神讨一个公道。 无数震古烁今的大能莫名消失,他们去向了何处? 世人模糊的记忆里,隐藏着怎样的秘密? 仙,避尘世,悟天道,纳灵修行,求长生不死。 魔,染业障,淬凡心,煅体炼神,为只手遮天。 她本是流离孤儿,天姿异禀,却恨入错师门。 他生于动荡乱世,命运多舛,只求安渡余生。 两人生于不同世界,却机缘巧合之下被命运绑到了一起。 窥天机,断生死,剑斩红尘,武逆乾坤。 “谁要杀你,我便杀谁,若是天命如此,我便逆了这天。”高考结束了,摆烂但又不想接受这样的自己,阴差阳错回到两年前本作品是一部相对严肃、严谨的历史小说,讲述的是夏商之交夏、商斗争的故事。本书收集了古书中关于夏商之际所有记载,包括近年来公布的出土文献的记载及部分历史研究和考古资料,其中既有历史记载也有神话传说,通过演绎和艺术加工,详细讲述夏商之际的故事,结构宏大,内容丰富,既有曲折的故事,也有很多的知识点,读了不会让您失望。嘀...嘀...嘀... 人死后灵魂究竟会魂归何处? 带着心中最后一个想法,许一安望向呈现一条直线的心电图,缓缓地闭上了双眼。 但......耳边...传来... “一安哥哥,一安哥哥。” 不,生命的旅途还远没有结束。在历经无数生死之后,那最终迎来的一切只是开始,历史似乎一直在轮回中。一觉醒来,这个世界再也不是熟悉的那个车水马龙的样子,纷乱的战火,各色的超能力,这是干嘛啊!觉醒了SSS级别的超能力,我是奶妈?不,我这是圣职者,惩戒与祝福才是我的专长,那个劳什子治疗,只是我附带的能力罢了!
美国 信息安全风险评估 计算机与网络安全 什么是网络营销员 网络营销能力秀群 email营销方式 网页是网站吗 网站及单位网站建设情况 深圳网站建设电话 信息安全技术 章程 公司网站设计与开发 信息安全等级保护培训考试 以色列的网络安全技术广州学网络营销 网络营销事件介绍 正规的搜索引擎营销企业 河南省网站建设 网络营销事件介绍 web网络安全教程 广东省网络安全应急响应平台 有了域名 网站建设 我国网络安全教育现状分析 网络安全管理员培训 个人免费网站注册com 个人免费网站注册com 南通网站建设 网站制作旅行社 国家推进网络安全()服务体系建设 企业网站需要响应式 信息安全保护管理规定 直接营销优缺点 企业外包营销策划 网络安全中的数据标签 河南省网站建设 对网络安全提建议 海外营销邮件 微博营销的方案总结 网络安全展览会 信息安全实验 pdf 昆明网站开发 帮建网站 鹤壁网站优化