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
响应式网站网络安全软硬件网站型营销富阳网站建设怎样网站栏目名网络安全标准规范中国工业信息安全电商营销课程电子工厂网站建设天津网站设计响应式网站网络营销实训课程电子产品商务网站模板移动网络营销定义网站设计psd网站永久免费建站中国网络安全部门信件营销国家信息安全网络安全电子产品商务网站模板保定 营销型网站建设信息安全大数据鹤壁网站制作营销技术在常用的网络营销方法中哪些网络营销的方法更适合中小企业衡水商城网站制作鹰潭网站建设病毒性营销案例视频电器网络营销方案什么是网络营销评估汕头 网站微网站后台不要在黑夜里高歌,怕惊醒那些沉睡在暗处的猛兽。 无穷浩瀚的宇宙,魔法,修真和科技并存。 这是一个探索未知的传奇,也是一首歌颂平凡的小曲。朱祐极穿越小说世界,成为大明四皇子,母亲是万贵妃,掌控西厂,与权臣严嵩、东厂曹正淳相互勾结,一手遮天。 然而,自己却并非亲生,而是狸猫换太子的产物,是万贵妃稳地位的工具。 内忧外患之下,朱祐极获得了【人生重来模拟器】系统。 【人生重来模拟器】系统,每天都可以抽取自己的开局功法!他花费三年的时间,抽取了一万次,终于抽到了天胡开局!诡异邪恶的门派,狼子野心的外族风雨飘摇的江湖,睿智勇敢的少年通过自己的努力,揭开隐秘至深的阴谋,联合所有能联合的力量,共抗外辱。既有阴谋诡算,又有刀光血影,更有无比恢弘的战场这个时代,要一位英雄,将四分五裂的大陆,重新归为一统!亲亲苦苦熬到大学毕业,李风一夜猝死,到了三万大千世界当起了编程员。 出身宗门世家,他小手轻轻一敲,世家子弟直接名望千里之外。 出身九阴之体,他小手一改,顺便捡到了包罗之象。 出生有黑鸦陪同,他手一挥,三千万凤凰卧地朝拜。 一日,李风发现,他可以直接编写自己的修为,无限制。 一日,李风发现,他还可以直接编写别人的修为,无限制。 又一日,李风发现,这个后台竟有一个更大的秘密。比如:编写一切圣灵,更改一切数据! 三个月后,李风成为天道正式编程员。 在强兵压城的某个夜晚,李风一个“手滑”,直接将敌方五百万大军修为下降两阶! 不够?那就给我再降! 路维上一秒还在小门派的最底层摸爬滚打,下一秒就成为了魔皇…… 有谁能告诉他这是什么情况? &amp;quot;魔皇大人!请带领我们重振魔族吧!&amp;quot; &amp;quot;呵呵&amp;quot;路维内心冷笑&amp;quot;这梦也太他妈真实了。&amp;quot; 且看疑似魔皇的少年如何走向巅峰。从这一刻开始,一切归零,一切历史一切的一切全都重新开始。这是末世,这是创世,这是天堂,这是地狱,这是一切的开始,这是一切的终结。民国初年,江沪青年司机玄狐,在驾驶车辆走夜路时,因碰撞阴魂煞气而丧命! 在九重天阴司府投胎审核寺,玄狐的鬼魂遇到此处监官铭难改等神仙,在进行投胎运程实验游戏,玄狐有幸被挑选参加这个游戏! 从此,玄狐开始扑朔迷离、危机四伏、艰苦卓绝、无穷无尽的换回磨难历程......火热1990,武长风敲开时代蛋壳,重生而出。 望着穷酸的家庭,高额负债,负气出走的老婆…… 他稳定心态: “先别慌,赚特么一波在说……” 唉? 这里有个野生的女骗子,一个大饼砸下去,收入囊中,为我所用。 女骗子:老娘行走江湖多年,从来未见过如此厚颜无耻之人! …… 大国崛起,工业为王!我从娘胎里出生,就带有魔道圣体,我的父亲是八方大陆的帝王,母亲是女帝,而我必将带领众人,让人见识见识我的天赋陈铁柱小时候是一个弃婴,被师父捡到抚养长大。 20岁那一年,师父告诉他,让他去下沙村做一名上门女婿。 师令难违,他一连做了5年的上门女婿,受尽了无数人的白眼,冷言冷语。 终于这一天,他爆发了.......
北京旅游型网站建设 太原seo网站建设 产品网络安全红线2.0 广州网络信息安全,-1 问答营销案例是什么 网络安全行业协会 衡水商城网站制作 网站永久免费建站 2014年中国计算机网络安全年会 rsa信息安全大会 2017 美强化网络安全新法案 电商营销课程 为什么有些网站搭建的是php其所有网页均已.htm命名 不是信息安全所包含的内容是 昆明建个网站哪家便宜 网络信息安全风险解决方案 珠海哪里做网站的 网站建设品牌推荐 网站建设 网络推广 杭州网站建设设计公司 公司网站与营销网站 潮州网站建设 电器网络营销方案什么是网络营销评估 win10网络安全设置 产品网络安全红线2.0 互联网营销是干什么的 网络安全的电视剧 云网站 简洁的网站 星巴克微信营销案例 rsa信息安全大会 2017 蘑菇街是什么营销模式 杭州网站推广 网站营销方案 网络安全管理小组 北京旅游型网站建设 关于公司的网站设计 星巴克微信营销案例 2017年信息安全威胁 做个网站多少钱