Bootstrap3 栅格系统-简介
2016-11-22 14:40
309 查看
Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列。它包含了易于使用的预定义类,还有强大的mixin 用于生成更具语义的布局。
简介
栅格系统用于通过一系列的行(row)与列(column)的组合来创建页面布局,你的内容就可以放入这些创建好的布局中。下面就介绍一下 Bootstrap 栅格系统的工作原理:
“行(row)”必须包含在 .container (固定宽度)或 .container-fluid (100% 宽度)中,以便为其赋予合适的排列(aligment)和内补(padding)。
通过“行(row)”在水平方向创建一组“列(column)”。
你的内容应当放置于“列(column)”内,并且,只有“列(column)”可以作为行(row)”的直接子元素。
类似 .row 和 .col-xs-4 这种预定义的类,可以用来快速创建栅格布局。Bootstrap 源码中定义的 mixin 也可以用来创建语义化的布局。
通过为“列(column)”设置 padding 属性,从而创建列与列之间的间隔(gutter)。通过为 .row 元素设置负值 margin 从而抵消掉为 .container 元素设置的 padding,也就间接为“行(row)”所包含的“列(column)”抵消掉了padding。
The negative margin is why the examples below are outdented. It’s so that content within grid columns is lined up with non-grid content.
Grid columns are created by specifying the number of twelve available columns you wish to span. For example, three equal columns would use three .col-xs-4.
如果一“行(row)”中包含了的“列(column)”大于 12,多余的“列(column)”所在的元素将被作为一个整体另起一行排列。
Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes, and override grid classes targeted at smaller devices. Therefore, applying any .col-md- class to an element will not only affect its styling on medium devices but also on large devices if a .col-lg- class is not present.
通过研究后面的实例,可以将这些原理应用到你的代码中。
相关文章推荐
- Bootstrap 栅格系统简介
- Bootstrap简介及Bootstrap里的栅格系统col-md/sm/xs-x;
- Bootstrap3 栅格系统-简介
- 学习笔记4-bootstrap的栅格系统
- Bootstrap3.0学习第二轮(栅格系统原理)
- Bootstrap3.0学习第二轮:栅格系统原理
- bootstrap3 用户界面架构学习 ----栅格系统
- Bootstrap 栅格系统
- MVC5 + EF6 + Bootstrap3 (7) Bootstrap的栅格系统
- 【9】了解Bootstrap栅格系统基础案例(4)
- 【10】了解Bootstrap栅格系统基础案例(5)
- Bootstrap3.0学习第三轮(栅格系统案例)
- Bootstrap栅格系统研究
- 【Bootstrap】自动适应PC、平板、手机的Bootstrap栅格系统
- bootstrap3.0 栅格系统
- Bootstrap3.0学习第三轮(栅格系统案例)
- Bootstrap3.0学习第三轮(栅格系统案例)
- Bootstrap3.0学习第三轮(栅格系统案例)
- bootstrap3.0教程之栅格系统案例(包括栅格选项、从堆叠到水平排列、移动设备和桌面等
- Bootstrap3.0学习第二轮(栅格系统原理)