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
信息安全通告服务二级域名对网站帮助做响应式的网站25个网站信息安全训练营江苏网站设计公司深圳视频营销推广金融信息安全产品英雄联盟营销模式南宁做网络营销信息安全应用技术,-1创建自己的个人网站青海网站建设网络安全的严峻形势营销短链网络安全密匙显示字符(h)深圳视频营销推广山东省网络安全竞赛长沙市网站制作公司营销推广理论什么是网络营销组合昆明高端网站建设公司苏州做网站推广的公司二级域名对网站帮助网站主持人东莞 外贸网站 建站app营销推广公司电话营销推广理论中国信息安全测评中心主任营销短链天道亦无常,人心更反复,世间三千疾,最苦是抉择。一个被命运驱使的少年自深山中走出,就此入世…风起云涌,仙道争锋,天意无常,人心不古…历经千难万险,又该作何选择?愿只随本心,纵错也无怨! 修道无始终,何以为巅峰… 偏拗执念深,百炼不为仙… 天意虽相悖,吾只随吾心… 万劫纵不复,无怨亦无悔…【家族流+不圣母+快节奏+半幕后流+半无敌】 一朝穿越,成为小家族家主的林洛,开局获得家族氪金暴击成长系统! 什么?天下万物,无不可暴击? 什么?暴击还能获得忠诚度? 给家主我使劲地暴暴暴! 天之骄子?去,我林家儿郎上去先扇他几个耳光! 修炼至宝?不好意思,我林家宝库不收这种垃圾! 武帝大佬?开玩笑,也就我林家护卫的水平! “天呐!我家家主逆天了!” 天骄辈出,大能投奔,林家之威,盖压寰宇! 且看林家如何在林洛的带领下,从微末小家族一步步成长为诸天帝族!天狼星是缆镇龙头老二施边边的绰号。 施边边出道前是读过好几本古书的。 会背东坡老师的《江城子 · 密州出猎 》:老夫聊发少年狂,左牵黄,右擎苍。 锦帽貂裘,千骑卷平岗。 为报倾城随太守,亲射虎,看孙郎。 酒酣胸胆尚开张,鬓微霜,又何妨! 持节云中,何日遣冯唐? 会挽雕弓如满月,西北望,射天狼。 客厅还请苍梧先生写了这首词,裱了起来,比起龙头老大钱鼓鼓只喜欢收藏所谓的玉石原石好多了。 钱鼓鼓收的所谓玉石原石全部来自云南,不知真假! 缆镇以前没有什么工业,所谓的工业就是做木质工艺品,因此木头原料是关键。 钱鼓鼓和施边边二个人垄断了缆镇的木头市场。 后来,缆镇开始搞建设,鼓捣水泥搅拌站是来钱快的生意,钱鼓鼓和施边边二人开始了水泥搅拌站的布局。 故事就这样开始了!一部关于神族与神族之间、怪族与人族发生的纷争,男主被一点点的牵扯进来,脱身?还是加入? 这是一部青春时期的回忆录。每个人的青春都是丰富多彩的,值得可歌可泣的,值得大说特说的,我们富有热血,我们积极向上,我们有过迷茫,也曾失落彷徨,愿你们独一无二的青春,能够得到你们想要的结果,活出自己的自由。特殊体质,资质绝佳,修炼救母。红尘中相视一眼,续写剪不断情缘。 不争大世,不逆天道,顺势修仙。无尽岁月一浮尘,凡人亦可登绝巅。一开始,穿成假太监的李易只想安分苟活着,但后来,看着高贵雍容的皇后,李易心思变了。 “江山你坐着,皇后我替你照顾。” 李易都跟皇帝打好了商量,奈何那把椅子,皇帝就是坐不稳啊! 前有狼,后有虎,奸臣又一堆堆,眼看国不国,家不家的,李易操起了屠刀……身怀不临世间法的百草小师叔郭玉磊,在某一天,带着一柄剑,一头猪,走下了终南山! 开始了他的传奇人生。 医术,可让大佬俯首,一针,可令百媚投怀。 以身为炉,炼化乾坤。以剑为坟,埋仙葬神! 当主角醒来,发现穿越成少年时的慕容复,而且身处十四部金书融合的大武侠世界里,他该何去何从,兴复大燕?争霸天下?又或是勾搭几个美女逍遥一生呢?本书书友群(扣扣群):463587739简介
互联网公司 营销 东莞营销型网站建设 如何用jsp和access2003制作一个有后台的数据库的网站 郭启全 网络安全 网络安全和信息化领导小组第四次会议 餐饮业的网络营销 信息安全领域cia信息安全服务(安全 网络安全与防火墙技术研究 信息安全人才现状 信息安全训练营 中山精品网站建设方案 营销短链 信息安全等级保护安全建设整改工作指南 信息安全 计算机考级 网站网速慢 提高网络安全意识建议 免飞网站 河北做网站哪家公司好 网站制作教程 信息安全课堂 郭启全 网络安全 网络营销面试邀请电话 苏州做网站 2017网络营销大会 中国信息安全测评中心主任 网络安全行业有哪些问题 建站员工网站 亳州网站制作 app营销推广公司电话 汕头网站推广 创新的南昌网站设计 信息安全的要素有哪些内容 网站制作教程 网站的建设 重庆新闻软文营销 中软网络安全考试 网络营销面试邀请电话 什么叫网站的空间感 网站关键词排名提高 网络安全专家服务