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
网络安全及信息网络安全电子版专业建设网站制作龙岗网站设计资讯网络安全竞答信息安全最好的大学北京网络安全周华为 信息安全 代码网络安全平台信息安全就是网络安全网站模板下载网络安全规则音乐网站如何建设的网站建的创新点上海做网站品牌公司专门型网站京东区域营销策略信息安全响应中心梧州网站优化天津网站建设包括哪些淘宝营销课程淘宝营销课程网络安全的5的因素顺德做网站的公司网络安全的特点中国信息安全部大型网站建设方案信息网络安全报警网金盾网络安全法讲解您的首页文件及网站程序需上传至ftp下的htdocs目录下流星下坠之夜,张玉舟来城南观看流星,无意间知道了庐阳王的秘密,却被庐阳王之子杀死,没想到一颗流星落在张玉舟尸体上,张玉舟复活,杀死了庐阳王唯一的儿子........苏州飞马堡无故被神秘组织所灭,马行空家破人亡,暗中调查找到幕后黑手青风堂,但却意外牵扯出三十年前武林一段风波,孰是孰非,如何决断?本书又名:《炒股致富真是太难了》、《韭菜的自我修养》、《如何不被股市绿》、《技术流&amp;amp;价值投资流的选择》、《亏损八成的我是如何回本的》、《斩断亏损让利润奔跑》、《拒绝成为股市中的乌合之众》、《炒股就是赌运气,别用实力亏掉靠运气赚的钱》······ 看铁逵炒股直播的网友们表示,以上书名都是错的,本书应该又名:《可恶,又被他买到涨停股了》、《放开那个涨停板,让我上!》、《高喊要亏光的他又赚到了》、《他真把股市当取款机》、《我要拜他为师学炒股》、《买股票一定要跟紧他的步伐》······林逍遥穿越到妖魔神佛并立的异界,开局统死机,被困十里坡刷了十年怪。十年后,系统重启,踏入江湖。竟发现自己能看到别人头顶的血条!且只要让对方掉血,就能获得经验值,抽取宝物!比如能够强行聚灵且强制击飞敌人的【聚灵小手套】、一戳就算钢铁直女也能变娘的【娘娘枪】、套上就能隐身的【丝袜头套】、包治百病的【药王身上搓下的泥球】……《大奉金店》简介,张忠臣穿越到奉天,本想开一家金店,发财过富裕的日子。没想到那时候兵荒马乱,土匪多如牛毛。不拿起枪杆子只有挨欺负的份。张忠臣被逼无奈,只得拿起枪杆子,跟随张大帅闯江湖,不知道他混得如何? 探子来报,报告张队长,有朝廷大官小老婆玉美人玉太太路过此地,我们抢不抢? 张队长回答,抢,不是抢来做压寨夫人,只是为巴结朝廷,为招安做准备。 不知道他们抢到玉美人玉太太没有? 请看《大奉金店》,更多精彩内容都在里面。 考研上岸的许青,终于端上了梦寐以求的铁饭碗。 只是,这个饭碗跟他想象的有点不一样,他穿越到一个刚刚亡故的捕快身上。 更是被一个身材高挑,黛眉星瞳的俊俏女捕头看中,被对方挑过去当手下。 许青原本是拒绝的。 直到他看见女捕头随随便便掰断了一根石头做的灯柱…… 女捕头:“我不喜欢勉强别人,你若不愿意跟着我便说出来。” 许青:“卑职愿意,这乃是卑职遵从内心的决定!无有半点勉强之意!” 网瘾少年石也城意外事故变成一只蚂蚁的故事这里没有玄幻,没有穿越;只有新活的生命,逻辑的真实。 这是一个虚构的故事;一个关于生意与情怀的故事。一群年轻人,在小说主人翁李非的带领下,历经千辛万苦,克服重重困难,在小城香州,书写了一段商业传奇。香水星河酒店,一个给予了无数客人美好记忆,承载着一群酒店人理想的航器,在到达了它辉煌的顶峰后,突然掉头…… 结果怎么样?为什么会这样?是历史的悲剧,还是人生的释然?——一千个读者就有一千个哈姆雷特——如果你想得出自己的结论,请阅读天界无际的小说《香水星河》。地球陷入灵界,高等级生灵支配人类 人类该何去何从张少锋被自己写的小说裹挟到异界,却因为能量不足被丢到了巨兽腹中跟食物混在一起,为了不被消化成翔,为了活下去,更为了找个老婆,他爆发与生俱来的最大潜力…… 地球少了谁,一样外转动,异界多了他,从此是非多!
大连企业做网站 网络安全应急响应制度 代运营网站 唐山网站建设费用 湖南手机网站制作公司 网络营销常用媒介方式 IDC网络安全要注意什么 关于我国网络信息安全与法律保护措施调查 诀窍的网站 北京网络安全周 怎么做问答营销的策划 单位网络安全等级保护工作年度考核情况 互联网营销百度百科 网络安全竞答 网络安全法律法规培训 金盾网络安全法讲解 网站欣赏网站 电商做网站 网站欣赏网站 网络营销资料 四川省网络安全大赛 淘宝如何实现网络营销 odex信息安全,-1 迪庆网站建设 网站模板下载 网站建的创新点 网络安全电子版 音乐网站如何建设的 虚拟专用网络安全问题 广州建网站 2014年网络营销大事件 信息安全 身份认证 上海做网站品牌公司 国家信息安全形式 信息网络安全报警网 迪庆网站建设 企业成功营销策略案例分析 全网整合营销服务商 专业建设网站制作 关于我国网络信息安全与法律保护措施调查