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
事件营销心得企业网络安全工程师福州建网站做网页西安制作网站的公司有晋城网站建设网站红蓝色配色分析www的网站怎么申请信息安全等级测评师培训如何报名建设网站的流程设计君网站网站制作信息安全服务年会信息安全威胁模型全面的手机网站建设网站背景色网站建设公司联系方式无锡网站推广公司网络安全等级保护定级网络信息安全宣传周网站所有页面信息安全对抗大赛微博营销的心得山大数学 信息安全营销推广的含义微信营销的案例分析实战网络营销国务院关于大力推进信息化发展和切实保障信息安全的若干意见2017年网络安全问题网络安全排行大庆做网站php网络安全神延大陆中央有一座没有山顶的大山,传说登顶这座山峰的人就算是凡人也能立地成仙。天道峰直指天道,所谓登峰造极登峰便是一条成仙的捷径,亘古至今,成仙者不计其数,但却无一人登上峰顶。天道峰到底通往哪里?仙界?神界?还是永恒? 唐皇国边陲山村小村民郭旬机缘之下得到一颗渡劫成功的天仙内丹,从此踏上不凡之路,为了追求永恒,他踏上了攀登天道峰的道路,成仙成魔尽在一念之间!吾一人踏路,天道路漫漫,怀赤子之心,追寻飘渺永恒,翻千山不停,越万界不止,吾心依然。公元2365年,全球袭来丧尸危机。百性逃的逃,死的死。一个男孩子带领大家前往避难所途中,经历了无数次困难,最后他们终于到达……我叶无心历千劫万险; 纵使魂飞魄散,我灵识依在; 战百世轮回,纵使六道无常,我依然永生; 洒我热血,一往无前,穿越了宇宙洪荒; 修我战枪,枪尖在燃烧……何人云端起舞; 让我望穿天涯,柔肠百折,心中风雪潇潇; 曲终人散,一枪刺破云霄,古今同一笑; 天地任逍遥,后世来者,莫与我比高。 亘古通今,各朝各代寻仙引无止。 曾半仙言: 后世不可解,一线生机,似是故人来,覆辙可移。 然:‘华表精,名隐仙,见之,呼其名,不害人。’ 渡凡成仙早已成就往事,可今望天微光,映照星河,恐有大世。一洛之海,万丈之深,水是命源,洛海之根主角李轩作为一个富二代怎么也没想到喝个酒一觉醒来就穿越成夏朝四皇子 可是这剧本不对啊 别人穿越都是各种金手指自带系统 李轩却什么都没有永安国北部山区爆发了大山洪,年轻人张四为了救援隔壁村的肉沫子,也被卷入了洪水中。 等到张四完全失去了意识之后,他被带到了一块神奇的漂浮大陆。 “这是哪?我是死了吗?”一脸懵逼的张四此时正在环顾着四周。 四周是无边的黑暗。 “张先生您好,我是智能航行机器人,我的代号是阿尔法,两个月后我将带您进行虚空航行,请您做好准备。” 张四看着眼前这个漂浮在空中的老式大肚子电视机,陷入了沉思。一个伟大的帝国就要陨落,新的时代就要到来。 朱慈炯也想过要去争一下那大位,可是你看看环伺周围的猛人,李自成、张献忠、多尔衮、吴三桂……罢了,还是做一只咸鱼吧…… 什么,你剥夺了我的王位,还想要我的命? 那可不行,老子也要当强盗! 朱慈炯发出这样的怒吼……我写的都是经历过后留下来,想要珍视的故事。 我出生于00年1月,作为这个世纪的第一批新生儿,总感觉要做些什么。 陌生的朋友,请听我说: 我们都要有越挫越勇的心态, 在我们保护不了珍视的事物前, 都要做好失去一切的准备。 我们要做命运的骑士, 如果要接受命运的安排, 那也只能是在我们拼尽全力之后。 现在的我虽然只是一条咸鱼, 可在我生命结束之前, 令人向往而又悲惨的世界啊, 我对你的回应也只有轻蔑, 我不会输的, 即使你能杀死我, 我的意志亦将如恢宏的太阳, 将尔扁如尘埃。2009年到2021年间,g城作为改革开放后迅速崛起的沿海城市之一,政治经济快速发展,商界奇才、慈善大家、教育大亨······齐聚在g城,由此展开一场场腥风血雨的争斗······
网络安全排行 网络营销总结与分析 电话营销托管 网络营销总结与分析 广告传媒公司网络营销 无锡网站推广公司 营销型网站和展示型网站的区别 成功企业的营销 昆明建企业网站多少钱 网络安全行业标准 信息安全等级测评师培训如何报名 苏州网站建设logo 网站设计流程 flash网站 大连网站建设价格 全国网络信息安全学院 公司建网站多少钱 什么是营销型手机网站建设 视频网站制作 网络安全技术规范 2017最新网络安全事件 佛山营销网站建设服务 网络营销有用的书籍 昆明建企业网站多少钱 北京网络安全招聘 做购物网站 网络安全战略合作协议 营销策略特点 2015国家信息安全 微信网络营销系统 网络营销方案撰写 建立网站需要多少钱 租车营销方案怎么写 个人微博营销技巧体会 网络安全基础 协议安全 信息安全等级测评师证 信息安全技术 操作系统安全技术要求,-1 网络安全行业标准 珠海移动网站建设公司排名 企业网络安全工程师