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
网络营销定价网站制作公司哪个好网络与信息安全的特点定制网站与模板网站的主要区别网站栏目名网站备案后网站建设的公司兰州网站设计关于注意网络安全南宁市制作网站的公司珠海动态网站制作外包网站制作公司哪个好营销应该怎么学北京时间网站建设团购网站建设关于网站出现.ldb文件网站打不开解决办法换成sql server网络安全 签名深圳整合网络营销推广淄博市网站开发北京时间网站建设微信营销标题怎么写信息安全大学内容,-1信息安全大赛比什么南京新媒体营销培训南京新媒体营销培训广东信息安全评测中心网站建设案例怎么样加强 提高信息安全网络安全座谈会音乐网站如何建设的享受007福报的顾修,重生回到世纪初,成为了六岁小学生。 看着刚刚创业失败,背负债务进入迷茫期的父亲。 “老爸,要不我给你指条明路?” “先定个小目标。” “成首富!” 于是,一个中年男人开始了自己的逆袭人生,一步步走出了一条首富之路。 可当他登上神坛的那一刻却发现…… “儿子,你才念小学,怎么早成首富了?” 顾修:谁规定小学生不能当首富了?  二十年前,一场大火,父母双亡,与妹妹分离。 二十年后,接到刺杀任务,在战斗过程中,猜测目标是和自己分开了二十多年的妹妹。 因为这个猜测,导致任务失败,受到组织惩罚,“意外”死亡。 重生后,在成长路上,发现了二十年前的那场大火里,还隐藏着不为人知的秘密……秦凡为救老婆,不得已暴露自身能看到宝物气息的能力,不断捡漏,只要是宝物,在秦凡的眼中都无所遁形,因此引起各方势力的注意,破真伪,看人心,鉴宝捡漏,玩转人生……掌混沌太荒之力,修真龙不灭之体,诸天万界,唯吾独尊,觉神脉,修神诀,武道之极,逆天屠神!穷苦修士意外穿越小时候,夺舍已知人物的给予修仙。 “你修仙?还不如种田,老子都是躺平修的。”天也败,地也衰。规则乱化,被四大宗门所掌控,为所欲为。李毅,一个小人物,后发先至,厚聚博发,誓与天斗。苍天泣血,诸神恐惧。完成了他的传奇一生。一座平平无奇的小中学,却隐藏着许多不,寻常的人…… 末日即将来临他们不得不出山去拯救世界……………………恐惧被刻在了血脉深处,人类永远记住了这一天! 虽然我完成了梦想,但钱途的这段过程并不容易,我一无所有过,也欠过一屁股债,甚至一时冲动,借高利贷,撸网贷,以贷养贷。   这段钱途的心酸历程,我送过外卖,送过快递,跑过网约车,做过农民工,卖过路边烤面筋。   创过业,也经历过失败。我叫傅轩 来到了一处人间天堂 本以为可以享尽荣华富贵 却发现 我怎么成了一只龙 嗯,这是....... 简介无力,请移步到正文
做网站资讯 网站托管 上海建设网站制作 网络与信息安全的特点 网络营销所面对的挑战 网络安全攻防 重庆网络营销哪家专业 营销培训费用 苏州网站维护 江西专业南昌网站建设 北京市重大网络安全事件 营销型企业网站 移动端网络安全 南京制作企业网站 做网站资讯 学网络安全 深圳网站建设哪家好 网站设计和备案 深圳网站建设哪家好 思科 企业网络安全解决方案 长沙专业做网站 移动端网络安全 外资 信息安全 信息安全峰会 中国国家信息安全政策 建网站费用 信息安全建设依据 石家庄网站制作 河南信息安全专业 网络与信息安全方向 培养计划 网络营销与推广方案 网站建设案例怎么样 上海网站设计开 达内网络营销视频教程 网络营销有用的书籍口碑营销重要性 深圳推广营销策划 龙岗网站设计资讯 网络营销所面对的挑战 信誉好的龙岗网站设计 网络与信息安全方向 培养计划