使用bootstrap框架的步骤

  1、引用bootstrap的css框架,这样可以通过bootstrap来布局;

    <link rel="stylesheet" href="../css/bootstrap.min.css">;

  2、引用bootstrap的js框架,这样可以使用;

    注意:因为bootstrap的js框架是基于jquery而写的,因此要引用bootstrap的js框架的时候必须先引入jquery,这样才能使用bootstrap的框架;

    <script src="../js/jquery-1.11.2-min.js"></script>
    <script src="../js/bootstrap.min.js"></script>

bootstrap的一些常用的布局:

  栅格化布局:

  Bootstrap栅格系统的工作原理:

  • “行(row)”必须包含在.container中,以便为其赋予合适的排列(aligment)和内补(padding)。
  • 使用“行(row)”在水平方向创建一组“列(column)”。
  • 你的内容应当放置于“列(column)”内,而且,只有“列(column)”可以作为行(row)”的直接子元素。
  • 类似Predefined grid classes like .row and .col-xs-4 这些预定义的栅格class可以用来快速创建栅格布局。Bootstrap源码中定义的mixin也可以用来创建语义化的布局。
  • 通过设置padding从而创建“列(column)”之间的间隔(gutter)。然后通过为第一和最后一样设置负值的margin从而抵消掉padding的影响。
  • 栅格系统中的列是通过指定1到12的值来表示其跨越的范围。例如,三个等宽的列可以使用三个.col-xs-4来创建。

表格:

  基本案例

    为任意<table>标签添加.table可以为其赋予基本的样式—少量的内补(padding)和水平方向的分隔线。这种方式看起来很多余!?但是我们觉得,表格元素使用的很广泛,如果我们为其赋予默认样式可能  会影响例如日历和日期选择之类的插件,所以我们选择将其样式独立出来。

    <table class="table"> ... </table>

  条纹状表格

  利用.table-striped可以给<tbody>之内的每一样增加斑马条纹样式。

    <table class="table table-striped"> ... </table>

  带边框的表格

  利用.table-bordered为表格和其中的每个单元格增加边框。

  <table class="table table-bordered"> ... </table>

  鼠标悬停

  利用.table-hover可以让<tbody>中的每一行响应鼠标悬停状态。

  <table class="table table-hover"> ... </table>

  紧缩表格

  利用.table-condensed可以让表格更加紧凑,单元格中的内部(padding)均会减半。

  <table class="table table-condensed"> ... </table>

  状态class

  通过这些状态class可以为行货单元格设置颜色。

Class 描述
.active 鼠标悬停在行或单元格上时所设置的颜色
.success 标识成功或积极的动作
.warning 标识警告或需要用户注意
.danger 标识危险或潜在的带来负面影响的动作
<!-- On rows -->
<tr class="active">...</tr>
<tr class="success">...</tr>
<tr class="warning">...</tr>
<tr class="danger">...</tr> <!-- On cells (`td` or `th`) -->
<tr>
<td class="active">...</td>
<td class="success">...</td>
<td class="warning">...</td>
<td class="danger">...</td>
</tr>

  

  响应式表格

  将任何.table包裹在.table-responsive中即可创建响应式表格,其会在小屏幕设备上(小于768px)水平滚动。当屏幕大于768px宽度时,水平滚动条消失。

    <div class="table-responsive"> <table class="table"> ... </table> </div>

表单

  基本案例

  单独的表单控件会被自动赋予一些全局样式。所有设置了.form-control<input><textarea><select>元素都将被默认设置为width: 100%;。将label和前面提到的这些控件包裹在.form-group中可以获得最好  的排列。

<form role="form">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter 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>

  

按钮选项

  使用下面列出的class可以快速创建一个带有样式的按钮。

<!-- 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>

  尺寸

  需要让按钮具有不同尺寸吗?使用.btn-lg.btn-sm.btn-xs可以获得不同尺寸的按钮。

<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>

  链接元素

可以为<a>添加.active class。

  <a href="#" class="btn btn-primary btn-lg active" role="button">Primary link</a>

   <a href="#" class="btn btn-default btn-lg active" role="button">Link</a>

可作按钮使用的HTML标签

  可以为<a><button><input>元素添加按钮class。

  

<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">

这些都为bootstrap的css样式,通过在class中添加这些样式名,便可以引用这些样式;

Bootstrap 基本用法的更多相关文章

  1. bootstrap基本用法

    进入中文官网:http://www.bootcss.com   开始第一个Demo   准备工作: (1)进入bootstrap中文官网,点击起步 (2)下载生产环境         下载好的文件是一 ...

  2. Bootstrap 基本用法(续)

    在bootstrap中有很多的组件,这些组件可以帮组我们更快的写出一些好看的样式,下面就是一些样式: 导航框: <ul class="nav nav-tabs"> &l ...

  3. 【Bootstrap简单用法】

    一.下载及使用 参考网站:http://www.bootcss.com/ 1.使用 BootCDN 提供的免费 CDN 加速服务(同时支持 http 和 https 协议) <!-- 最新版本的 ...

  4. bootStrap @media 用法

    一. @media 格式 @media all and (min-width:xxx) and (max-width:xxx) (亦可以写成@media all and (min-width:xxx) ...

  5. JS组件系列——表格组件神器:bootstrap table

    前言:之前一直在忙着各种什么效果,殊不知最基础的Bootstrap Table用法都没有涉及,罪过,罪过.今天补起来吧.上午博主由零开始自己从头到尾使用了一遍Bootstrap Table ,遇到不少 ...

  6. bootstrap data

    bootstrap data 用法 <div data-role="page" data-last-value="43" data-hidden=&quo ...

  7. 【转】bootstrap 的 affix.js 插件

    我觉得 Twitter Bootstrap 提供的 JavaScript 插件可用性非常高,但文档多数简单.按部就班操作了,有效果当然好,没效果的话简直不知道为什么.之前我写过 Scrollspy 用 ...

  8. python 全栈开发,Day57(响应式页面-@media介绍,jQuery补充,移动端单位介绍,Bootstrap学习)

    昨日内容回顾 ajax //get post 两种方式 做 请求 get 主要是获取数据 post 提交数据 同一个路由地址 既可以是get请求也可以是post请求 一个路由对应一个函数 get请求 ...

  9. [转]JS组件系列——表格组件神器:bootstrap table

    原文地址:https://www.cnblogs.com/landeanfen/p/4976838.html 前言:之前一直在忙着各种什么效果,殊不知最基础的Bootstrap Table用法都没有涉 ...

随机推荐

  1. Oracle数据库多语言文字存储解决方案

    一.关于字符集 字符集(也称字元集,Character Set)就是字符编码表(codepage),一个字符不论英文.中文.韩文等在计算机系统内存或硬盘中通过二进制的字节(Byte)保存,这个二进制的 ...

  2. 你可能不知道的Linux/GNU bash sort多列排序功能

    (转载请注明原创于潘多拉盒子) Linux man pages的缺点就是,如果你不会用某个命令,那么看完了多半还是不会.原因是,没有例子!比较囧吧? sort是提供了多列排序的功能的.通过-k选项,可 ...

  3. IE6文字溢出BUG(多出来的猪问题)

    在IE6下使用浮动可能会出现文字重复的情况. 在IE6下,浮动层之间有注释文字的话,之前那个浮动层的内容文字就有可能遭遇一个“隐形”的复制,但是代码里查看文字可并没有多出来. 看个例子: HTML & ...

  4. UE 的使用

    1.查找,只匹配整个词语:匹配词语Andy,而不匹配包含Andy的词语,Andy前后有特殊字符才能匹配成功,前后的特殊字符表明Andy是一个词语. 2.正则表达式匹配,如下: 符号 功能 % 匹配行首 ...

  5. 使用jQuery Mobile和Phone Gap开发Android应用程序

    经过了一段时间的学习,初步了解了该如何使用jQuery Mobile和 Phone Gap来开发一个Android应用程序,也想把这些东西介绍给大家. 1. 软件准备 要进行android app的开 ...

  6. CodeForces 164C Machine Programming 费用流

    Machine Programming 题目连接: http://codeforces.com/problemset/problem/164/B Descriptionww.co One remark ...

  7. Codeforces Gym 100463D Evil DFS

    Evil Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463/attachments Descr ...

  8. INDY idhttp Post用法

    http://www.cnblogs.com/tk-del/archive/2013/05/10/3071541.html function Post(AURL: string; ASource: T ...

  9. 关于THIS_FILE

    VC++中本身就有内存泄漏检查的机制,可以在向导生成的支持MFC的工程中看到如下代码:  #ifdef _DEBUG  #define new DEBUG_NEW  #undef THIS_FILE  ...

  10. WebService究竟是什么?

    一.序言 大家或多或少都听过WebService(Web服务),有一段时间非常多计算机期刊.书籍和站点都大肆的提及和宣传WebService技术,当中不乏非常多吹嘘和做广告的成分.可是不得不承认的是W ...