Bootstrap
?
<p>Official introduction: A simple, intuitive, and powerful front-end development framework that makes web development faster and simpler.
<p>2.Bootstrap
Download
<p>Bootstrap3 download address: http://v3.bootcss.com/getting...
<p>3.Bootstrap
File directory structuredist -css -bootstrap.css -bootstrap.css.map -bootstrap.min.css(常用) -bootstrap-theme.css -bootstrap-theme.css.map -bootstrap-theme.min.css -fonts -glyphicons-halflings-regular.eot -glyphicons-halflings-regular.svg -glyphicons-halflings-regular.ttf -glyphicons-halflings-regular.woff -js -bootstrap.js -bootstrap.min.js(常用) -npm.js
Bootstrap
Dependencies<p>If you want to use Bootstrap
, you must First introduce the jQuery (jquery.min.js) file. <p>5. UseBootstrap
<p>The compressed version is suitable for practical applications, and the uncompressed version is suitable for development and debugging<!-- 新 Bootstrap 核心 CSS 文件 --> <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css"> <!-- 可选的Bootstrap主题文件(一般不用引入) --> <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap-theme.min.css"> <!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <!-- 最新的 Bootstrap 核心 JavaScript 文件 --> <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
Bootstrap
Basic template<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 基本模板</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <h1>你好,世界!</h1> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html>
<!DOCTYPE html> <html> ... </html>
viewport
metadata tag needs to be added to the <head>
. <meta name="viewport" content="width=device-width, initial-scale=1">
user-scalable=no
through the viewport to disable its zooming function, so that the user can only scroll the screen . (It depends on the situation) <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scala=1, user-scalable=no">
body
element: #fff;
,
@font-size-base and
@line-height-base a variables as basic parameters for typesetting
, and only adds an underline when the link is in the
:hover state
file.
Normalize.cssIn order to enhance the consistency of cross-browser performance, bootstrap uses <p>Normalize.css, which was developed by Nicolas Gallagher and A CSS reset style library maintained by Jonathan Neal. Layout containerBootstrap needs to wrap a <p>.container container for page content and grid system. Bootstrap provides two classes for this purpose. Note that due to attributes such as
padding, these two container classes cannot be nested in each other.
<p>.container class is used for fixed-width containers that support responsive layout.
<div class="container"> ... </div>
class is used for containers with 100% width and occupying the entire viewport.
<div class="container-fluid"> ... </div>
(fixed width) or
. container-fluid (100% width) to give it proper alignment and padding.
and
.col-xs-4 can be used to quickly create grid layouts. In the Bootstrap source code Defined mixins can also be used to create semantic layouts.
padding
属性,从而创建列与列之间的间隔(gutter)。通过为 .row
元素设置负值margin
从而抵消掉为 .container
元素设置的 padding
,也就间接为“行(row)”所包含的“列(column)”抵消掉了padding
。.col-xs-4
..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./* 超小屏幕(手机,小于 768px) */ /* 没有任何媒体查询相关的代码,因为这在 Bootstrap 中是默认的(还记得 Bootstrap 是移动设备优先的吗?) */ /* 小屏幕(平板,大于等于 768px) */ @media (min-width: @screen-sm-min) { ... } /* 中等屏幕(桌面显示器,大于等于 992px) */ @media (min-width: @screen-md-min) { ... } /* 大屏幕(大桌面显示器,大于等于 1200px) */ @media (min-width: @screen-lg-min) { ... }
max-width
从而将 CSS 的影响限制在更小范围的屏幕大小之内@media (max-width: @screen-xs-max) { ... } @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { ... } @media (min-width: @screen-md-min) and (max-width: @screen-md-max) { ... } @media (min-width: @screen-lg-min) { ... }
超小屏幕 手机 (<768px) | 小屏幕 平板 (≥768px) | 中等屏幕 桌面显示器 (≥992px) | 大屏幕 大桌面显示器 (≥1200px) | |
---|---|---|---|---|
栅格系统行为 | 总是水平排列 | 开始是堆叠在一起的,当大于这些阈值时将变为水平排列C | 同左 | 同左 |
.container 最大宽度 | None (自动) | 750px | 970px | 1170px |
类前缀 | .col-xs- | .col-sm- | .col-md- | .col-lg- |
列(column)数 | 12 | 12 | 12 | 12 |
最大列(column)宽 | 自动 | ~62px | ~81px | ~97px |
槽(gutter)宽 | 30px (每列左右均有 15px) | 同左 | 同左 | 同左 |
可嵌套 | 是 | 是 | 是 | 是 |
偏移(Offsets) | 是 | 是 | 是 | 是 |
列排序 | 是 | 是 | 是 | 是 |
.col-md-*
栅格类,就可以创建一个基本的栅格系统,在手机和平板设备上一开始是堆叠在一起的(超小屏幕到小屏幕这一范围),在桌面(中等)屏幕设备上变为水平排列。所有“列(column)必须放在 ” .row
内。<p><div class="row"> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> </div> <div class="row"> <div class="col-md-8">.col-md-8</div> <div class="col-md-4">.col-md-4</div> </div> <div class="row"> <div class="col-md-4">.col-md-4</div> <div class="col-md-4">.col-md-4</div> <div class="col-md-4">.col-md-4</div> </div> <div class="row"> <div class="col-md-6">.col-md-6</div> <div class="col-md-6">.col-md-6</div> </div>
.col-xs-*
和 .col-md-*
。请看下面的实例,研究一下这些是如何工作的。<p><!-- Stack the columns on mobile by making one full-width and the other half-width --> <div class="row"> <div class="col-xs-12 col-md-8">.col-xs-12 .col-md-8</div> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> </div> <!-- Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop --> <div class="row"> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> </div> <!-- Columns are always 50% wide, on mobile and desktop --> <div class="row"> <div class="col-xs-6">.col-xs-6</div> <div class="col-xs-6">.col-xs-6</div> </div>
到
均可使用。另外,还提供了 .h1
到 .h6
类,为的是给内联(inline)属性的文本赋予标题的样式<p><h1>h1. Bootstrap heading</h1> <h2>h2. Bootstrap heading</h2> <h3>h3. Bootstrap heading</h3> <h4>h4. Bootstrap heading</h4> <h5>h5. Bootstrap heading</h5> <h6>h6. Bootstrap heading</h6>
<small>
标签或赋予 .small
类的元素,可以用来标记副标题。<h1>h1. Bootstrap heading <small>Secondary text</small></h1> <h2>h2. Bootstrap heading <small>Secondary text</small></h2> <h3>h3. Bootstrap heading <small>Secondary text</small></h3> <h4>h4. Bootstrap heading <small>Secondary text</small></h4> <h5>h5. Bootstrap heading <small>Secondary text</small></h5> <h6>h6. Bootstrap heading <small>Secondary text</small></h6>
font-size
设置为 <strong>14px,line-height
设置为 <strong>1.428。这些属性直接赋予 元素和所有段落元素。另外,
(段落)元素还被设置了等于 1/2 行高(即 10px)的底部外边距(margin)。.lead
类可以让段落突出显示。<p class="lead">...</p>
@font-size-base
和 @line-height-base
。第一个变量定义了全局 font-size 基准,第二个变量是 line-height 基准。我们使用这些变量和一些简单的公式计算出其它所有页面元素的 margin、 padding 和 line-height。自定义这些变量即可改变 Bootstrap 的默认样式<mark>
标签You can use the mark tag to <mark>highlight</mark> text.
<del>
标签。<p><del>This line of text is meant to be treated as deleted text.</del>
<s>
标签。<p><s>This line of text is meant to be treated as no longer accurate.</s>
<ins>
标签<p><ins>This line of text is meant to be treated as an addition to the document.</ins>
<u>
标签。<p><u>This line of text will render as underlined</u>
<small>
<strong>
标签<em>
标签<p class="text-left">Left aligned text.</p> <p class="text-center">Center aligned text.</p> <p class="text-right">Right aligned text.</p> <p class="text-justify">Justified text.</p> <p class="text-nowrap">No wrap text.</p>
<p class="text-lowercase">Lowercased text.</p> <p class="text-uppercase">Uppercased text.</p> <p class="text-capitalize">Capitalized text.</p>
<blockquote>
来表示引用样式。对于直接引用,建议使用 <p>
标签。<blockquote> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p> </blockquote>
<ul> <li>...</li> </ul>
<ol> <li>...</li> </ol>
For example, <code><section></code> should be wrapped as inline.
kbd
标签标记用户通过键盘输入的内容。<p>To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br> To edit settings, press <kbd><kbd>ctrl</kbd> + <kbd>,</kbd></kbd>
<div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"></pre><div class="contentsignin">Copy after login</div></div>
标签。为了正确的展示代码,注意将尖括号做转义处理。
<var></var>
标签标记变量
<samp></samp>
tag to mark the content of the program output
The above is the detailed content of Let's talk about the knowledge points that beginners need to master with Bootstrap. For more information, please follow other related articles on the PHP Chinese website!