前端——Bootstrap
Bootstrap介绍Bootstrap是Twitter开源的基于HTML、CSS、JavaScript的前端框架。 它是为实现快速开发Web应用程序而设计的一套前端工具包。 以前自己写的html的缺点: 命名:重复、复杂、无意义(想个名字费劲) 样式:重复、冗余、不规范、不和谐 页面:错乱、不规范、不和谐 ? Bootstrap的优点: ?各种命名都统一并且规范化。 页面风格统一,画面和谐。 ? Bootstrap环境搭建目录的结构: bootstrap-3.3.7-dist/ ├── css // CSS文件 │ ├── bootstrap-theme.css // Bootstrap主题样式文件 │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css // 主题相关样式压缩文件 │ ├── bootstrap-theme.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css // 核心CSS样式压缩文件 │ └── bootstrap.min.css.map ├── fonts // 字体文件 │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 └── js // JS文件 ├── bootstrap.js ├── bootstrap.min.js // 核心JS压缩文件 └── npm.js
我们主要用的是: bootstrap.min.css // 核心CSS样式压缩文件 bootstrap.min.js // 核心JS压缩文件 ? 我们可以通过官网来学习bootstrap为我们所有提供的一些模型(点我) ? Bootstrap里面有一个重要的概念为 栅格系统; ?栅格系统本质上就是在container类的标签下面, <div class="container"> ... </div> 把每一行(row)均分成12列;(col--xx[lg,md,sm,xs]--**[1~12],列必须放在row中),xs为手机端的时候显示,md为桌面显示器 的时候显示; 每一个标签可以自定义占的列数(col--xx--**); 如果在一个? ( 当标签所占的列数大于这一行剩余的列数的时候,会另起一行来存放该标签;) 列偏移使用? 列排序使用? .col-md-push-* [1~12] 可以很容易的改变列(column)的顺序。 push为向右推;pull为向左拉; ? 常用的样式可以直接去官网去查询;(点我) 这里只是总结了一小部分Bootstrap全局样式标题相关<h1>一级标题36px</h1> <h2>二级标题30px</h2> <h3>三级标题24px</h3> <h4>四级标题18px</h4> <h5>五级标题14px</h5> <h6>六级标题12px</h6> <!--除了使用h标签,Bootstrap内置了相应的全局样式--> <!--内联标签应用标题样式--> <span class="h1">一级标题36px</span> <span class="h2">二级标题30px</span> <span class="h3">三级标题24px</span> <span class="h4">四级标题18px</span> <span class="h5">五级标题14px</span> <span class="h6">六级标题12px</span>
副标题 <!--一级标题中嵌入小标题--> <h1>一级标题<small>小标题</small></h1> ? 文本对齐<!--文本对齐--> <p class="text-left">文本左对齐</p> <p class="text-center">文本居中</p> <p class="text-right">文本右对齐</p>
文本大小写<!--大小写--> <p class="text-lowercase">Lowercased text.</p> //小写 <p class="text-uppercase">Uppercased text.</p> //大写 <p class="text-capitalize">Capitalized text.</p> //首字母大写
按钮<a class="btn btn-default" href="#" role="button">Link</a> <button class="btn btn-default" type="submit">Button</button> <input class="btn btn-default" type="button" value="Input"> <input class="btn btn-default" type="submit" value="Submit">
按钮样式
<!-- Standard button --> <button type="button" class="btn btn-default">(默认样式)Default</button> <!-- Provides extra visual weight and identifies the primary action in a set of buttons --> <button type="button" class="btn btn-primary">(首选项)Primary</button> <!-- Indicates a successful or positive action --> <button type="button" class="btn btn-success">(成功)Success</button> <!-- Contextual button for informational alert messages --> <button type="button" class="btn btn-info">(一般信息)Info</button> <!-- Indicates caution should be taken with this action --> <button type="button" class="btn btn-warning">(警告)Warning</button> <!-- Indicates a dangerous or potentially negative action --> <button type="button" class="btn btn-danger">(危险)Danger</button> <!-- Deemphasize a button by making it look like a link while maintaining button behavior --> <button type="button" class="btn btn-link">(链接)Link</button>
按钮大小 <p> <button type="button" class="btn btn-primary btn-lg">(大按钮)Large button</button> <button type="button" class="btn btn-default btn-lg">(大按钮)Large button</button> </p> <p> <button type="button" class="btn btn-primary">(默认尺寸)Default button</button> <button type="button" class="btn btn-default">(默认尺寸)Default button</button> </p> <p> <button type="button" class="btn btn-primary btn-sm">(小按钮)Small button</button> <button type="button" class="btn btn-default btn-sm">(小按钮)Small button</button> </p> <p> <button type="button" class="btn btn-primary btn-xs">(超小尺寸)Extra small button</button> <button type="button" class="btn btn-default btn-xs">(超小尺寸)Extra small button</button> </p> ? 内容块居中 <div class="center-block">...</div>
快速浮动 <div class="pull-left">...</div> <div class="pull-right">...</div>
清除浮动 <!-- Usage as a class --> <div class="clearfix">...</div> ? 显示与隐藏 <div class="show">...</div> <div class="hidden">...</div>
设置viewport 一个常用的针对移动网页优化过的页面的 viewport meta 标签大致如下: <meta name=”viewport” content=”width=device-width,initial-scale=1,maximum-scale=1″>
JS插件: 常用的Bootstrap自带的插件(见官网) 其他常用的插件,比如(Toastr?模态框弹出的(用作通知),详细的用法) ; (Font Awesome 用作图标的)
一个不错的管理后台模板: 模块 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |