Home > Article > Web Front-end > Summarize the usage examples of bootstrap front-end framework
Global style style.css:
1. Remove the margin statement of the body
2. Set the background color of the body to white
3. Set the basic font, font size and line height for typesetting
4. Set the global link color, and the underline style will be displayed only when the link is in the floating ":hover" state
All title tags in HTML,
1. Reset the values of margin-top and margin-bottom
2. The values of h1~h3 after reset are all 20px; the values of h4~h6 after reset are all 10px
3. The line height of all titles is 1.1 (that is, 1.1 times the font-size), and the text color and font inherit the color and font of the parent element
4. Fixed Different levels of title font size, h1=36px, h2=30px, h3=24px, h4=18px, h5=14px and h6=12px
You can also include the tag in the title or give it the .small class element that can be used to mark subtitles.
<h2>Bootstrap heading <small>Secondary Text</small></h2>
(paragraph) element also The bottom margin is set to 10px.
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.
Paragraphs can be highlighted by adding the .lead class.
b9e65200126209438507c030bae1f255
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus . Nullam id dolor id nibh ultricies vehicula.
bc5574f69a0cba105bc93bd3dc13c4ec
8c836cae9a587cbdfa9d25493fcc3e25Generally used with paragraph tags
Emphasis on related classes
text-muted: 提示,使用浅灰色(#999)text-primary:主要,使用蓝色(#428bca)text-success:成功,使用浅绿色(#3c763d)text-info: 通知信息,使用浅蓝色(#31708f)text-warning:警告,使用黄色(#8a6d3b)text-danger: 危险,使用褐色(#a94442)
text-left: 左对齐 text-center: 居中对齐 text-right: 右对齐 text-justify:两端对齐
1, ul, ol < ;span style="color:red;">Desequence54bdf357c58b8a65c66d7c19c8e4d114:
class=“list-unstyled“
2, ul, ol 73b597b9c5e6d5ba87af8e04a3fe41c3Horizontal arrangementd6d448110e0324953b5d7bc1e2b276ce (Change the vertical list into a horizontal list, remove the bullets (numbers), and keep the horizontal display)
class=“list-inline”
3. dl horizontal list (when the screen is larger than 768px, add the class name ".dl-horizontal" ” has the horizontal definition list effect)
class=“dl-horizontal”
The method of use is very simple, just add the corresponding class name to the
tag
img-responsive: Responsive images, mainly for responsive design
img-rounded: 圆角图片 img-circle: 圆形图片 img-thumbnail: 缩略图片
Add it yourself and check the corresponding effect~ ~ ~
Bootstrap The framework also provides you with nearly 200 different icon images, and these icons are all icon effects achieved using the @font-face attribute of CSS3 in conjunction with fonts.
Any row-level element is acceptable, usually span tags are used as icon containers
7cda7d4b173f6b140d13745a8aab6ad2Can be viewed on the bootstrap website;span>
Usage is very simple, just copy and paste the English under the icon into the class:
<span class="glyphicon glyphicon-ok"></span>##2, bootstrap-tableBasic Example
<table class="table"></table>
通过这些状态类可以为行或单元格设置颜色。
Class 描述
.active 鼠标悬停在行或单元格上时所设置的颜色.success 标识成功或积极的动作.info 标识普通的提示信息或动作.warning 标识警告或需要用户注意.danger 标识危险或潜在的带来负面影响的动作
将任何 .table 元素包裹在 .table-responsive 元素内,即可创建响应式表格,其会在小屏幕设备上(小于768px)水平滚动。当屏幕大于 768px 宽度时,水平滚动条消失。
<div class="table-responsive"> <table class="table"> ... </table> </div>
单独的表单控件会被自动赋予一些全局样式。所有设置了 .form-control
类的 d5fd7aea971a85678ba271703566ebfd
、4750256ae76b6b9d804861d8f69e79d3
和 221f08282418e2996498697df914ce4e
元素都将被默认设置宽度属性为 width: 100%;。 将 label
元素和前面提到的控件包裹在 .form-group
中可以获得最好的排列。
<form role="form">告诉辅助设备(如屏幕阅读器)这个元素所扮演的角色是个表单</form><form role="button">告诉设备,这是个按钮,可以点击。本质上是增强语义性,增强组件的可访问性、可用性</form>
不要将表单组合输入框组混合使用,建议将输入框组嵌套到表单组中使用。
<form> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email"> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password"> </div> <div class="form-group"> <label for="exampleInputFile">File input</label> <input type="file" id="exampleInputFile"> <p class="help-block">Example block-level help text here.</p> </div> <div class="checkbox"> <label> <input type="checkbox"> Check me out </label> </div> <button type="submit" class="btn btn-default">Submit</button> </form>
多个控件可以排列在同一行:
<form class="form-inline"> <div class="form-group"> <label for="exampleInputName2">Name</label> <input type="text" class="form-control" id="exampleInputName2" placeholder="Jane Doe"> </div> <div class="form-group"> <label for="exampleInputEmail2">Email</label> <input type="email" class="form-control" id="exampleInputEmail2" placeholder="jane.doe@example.com"> </div> <button type="submit" class="btn btn-default">Send invitation</button> </form>
通过为表单添加 .form-horizontal
类,并联合使用 Bootstrap 预置的栅格类,可以将 label 标签和控件组水平并排布局。这样做将改变 .form-group
的行为,使其表现为栅格系统中的行(row),因此就无需再额外添加 .row 了。
多选框(checkbox)
用于选择列表中的一个或多个选项,而单选框(radio)
用于从多个选项中只选择一个。
设置了disabled
属性的单选或多选框都能被赋予合适的样式。对于和多选或单选框联合使用的 2e1cf0710519d5598b1f0f14c36ba674 标签,如果也希望将悬停于上方的鼠标设置为“禁止点击”的样式,请将 .disabled 类赋予 .radio、.radio-inline、.checkbox、.checkbox-inline 或 2b5469ab79cf842344327415c3b3bb95。
多选框:
<div class="checkbox"> <label> <input type="checkbox" value=""> Option one is this and that—be sure to include why it's great </label></div> <div class="checkbox disabled"> <label><input type="checkbox" value="" disabled> Option two is disabled </label></div>
单选框:
<div class="radio"> <label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2"> Option two can be something else and selecting it will deselect option one </label> </div> <div class="radio disabled"> <label> <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3" disabled> Option three is disabled </label> </div>
通过将 .checkbox-inline 或 .radio-inline 类应用到一系列的多选框(checkbox)或单选框(radio)控件上,可以使这些控件排列在一行。
参考博文:bootstrap框架怎么用?
The above is the detailed content of Summarize the usage examples of bootstrap front-end framework. For more information, please follow other related articles on the PHP Chinese website!