原文地址:http://www.phloxblog.in/bootstrap-buttons/#.U5xYso2fclm

站点中事件的触发往往依赖于button或者超链接。因此,button能够觉得是站点不可或缺的组件。

而BootStrap也包括了大量的button,可是与其它的库有非常大的差别。本文则是对怎样在BootStrap中使用button进行了解说。

button样式

不论什么仅仅要赋予了.btn这个类的Dom对象会自己主动继承默认样式:圆角灰色button。除此之外,BootStrap也提供了其它的样式选项,例如以下表所看到的:

类名

描写叙述

颜色

实例

btn

Default/ Standard button.

White

<button type=”button”>Default Button</button>

btn-primary

Identifies the primary action .

Blue

<button type=”button”>Primary Button</button>

btn-success

Indicates a successful action.

Green

<button type=”button”>Success Button</button>

btn-warning

Indicates caution.

Yellow

<button type=”button”>Warning Button</button>

btn-danger

Indicates a dangerous action.

Red

<button type=”button”>Danger Button</button>

btn-link

Making a button look like link.

Blue

<button type=”button”>Link Button</button>

button状态

BootStrap也提供了改动button状态:active或者disabled的类。

激活状态

button呈现为按下的状态(含阴影的深灰色背景),下表解释了使用方法。

Element

Class

Description

Example

Button element

.active

Use .active class to show that it is activated.

<button type=”button”>

Active Button

</button>

失效状态

当禁止某个button时。它的颜色会褪色50%而且失去其梯度权重。

Element

Class

Description

Example

Button element

disabled

Add the disabled attribute to <button> buttons.

<button type=”button” disabled=”disabled”>

Disabled Button

</button>

Anchor element

disabled

Add the disabled class to <a> buttons.

<a href=”#” role=”button”>

Disabled Link

</a>

button大小

Class

Description

Example

.btn-lg

This makes button size large.

<button type=”button”>

Large Primary button

</button>

.btn-sm

This makes button size small.

<button type=”button”>

Small Primary button

</button>

.btn-xs

This makes button size extra small.

<button type=”button”>

Extra small Primary button

</button>

.btn-block

This creates block level buttons.

<button type=”button”>

Block level Primary button

</button>

完整的代码例如以下所看到的:

<!DOCTYPE html>
<html> <head>
<title>Try Bootstrap Online</title>
<script data-require="jquery@*" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script data-require="bootstrap@*" data-semver="3.1.1" src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link data-require="bootstrap-css@3.1.1" data-semver="3.1.1" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
</head> <body>
<p> <button type="button" class="btn btn-link btn-lg">Large link button
</button>
</p>
<p>
<button type="button" class="btn btn-primary">
Default size Primary button
</button></p><p>
<button type="button" class="btn btn-default">
Default normal size button
</button>
</p>
<p> <button type="button" class="btn btn-warning btn-sm">
Small warning button
</button>
</p>
<p> <button type="button" class="btn btn-success btn-xs">
Extra small success button
</button>
</p>
<p>
<button type="button" class="btn btn-primary btn-lg btn-block btn-lg active">
Block level Active Primary button
</button>
<button type="button" class="btn btn-danger btn-default btn-lg btn-block btn-lg disabled">
Danger Block Disabled button
</button>
</p>
</body>
</html>

BootStrap中的button使用的更多相关文章

  1. bootstrap中popover.js(弹出框)使用总结+案例

    bootstrap中popover.js(弹出框)使用总结+案例 *转载请注明出处: 作者:willingtolove: http://www.cnblogs.com/willingtolove/p/ ...

  2. bootstrap中的Tooltips工具提示的使用问题

    在使用bootstrap中的Tooltips时,官方文档中的实例代码若直接放在.container 或 .container-fluid类中时,四个button悬停之后会把button之间的margi ...

  3. Bootstrap中的less基础

    在线编译 因为 less 的语法毕竟相对简单,所以一些在线工具可以很轻松的做到.比如 http://less.cnodejs.net http://www.ostools.net/less  一般都有 ...

  4. 57、Bootstrap中文文档

    给大家介绍一个前端框架让你从此写起前端代码与之先前相比如有神助般的效果拉就是Bootstrap. 一.Bootstrap的下载 Bootstrap,由Twitter的设计师Mark Otto和Jaco ...

  5. 12、Bootstrap中文文档(其它插件分享)

    给大家介绍一个前端框架让你从此写起前端代码与之先前相比如有神助般的效果拉就是Bootstrap. 本片导航: Bootstrap的下载 css样式的使用 JavaScript 效果的引用 其他前端插件 ...

  6. bootstrap 中关于 HTML5 aria-* and role的用法

    HTML5 aria-* and role 在bootstrap中看到role和aria-*,不知道干嘛的.google一下,发现aria的意思是Accessible Rich Internet Ap ...

  7. Bootstrap中关于input里file的样式更改

    给input里file类型加button样式 1.在Bootstrap中input里的file类型样式很不美观,一个按钮加一段文字,还会随浏览器的不同呈现不同的样式,所以开发的时候可以将file的样式 ...

  8. Bootstrap中轮播图

    Bootstrap中轮播图插件叫作Carousel,为了清晰的表明每个标签在这里是什么意思,我把解释写在了下面的代码中. <!-- 以下容器就是整个轮播图组件的整体, 注意该盒子必须加上 cla ...

  9. bootstrap中使用日历控件

    在bootstrap中使用日历控件可以参照以下资料: http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm 以下是参照此资料自己做的一 ...

随机推荐

  1. h5手势密码开发(使用jq)

    直接上代码: 目录结构: 本次开用到的技术jq,以及引入的jq插件jquery.gesture.password.min.js index.html <!DOCTYPE html> < ...

  2. 欢迎来到abc2237512422的博客

    这是第一篇博文. 本博客已迁移到 abc233.site

  3. **如何让CI框架支持service层

    http://www.bitscn.com/pdb/php/201411/404708.html 大家知道CodeIgniter框架式MVC分层的,通常大家把业务逻辑写到Controller中,而Mo ...

  4. .NetCore使用Swagger进行单版本或多版本控制处理

    前面已经介绍过了Swagger的基础使用了 下面继续分别详细说明下 不添加版本控制以及添加版本控制的使用情况,其实也基本一致,对看起来可能更加容易理解 第一步 导入nuget包 nuget导入Swas ...

  5. elasticflow

    https://github.com/robcowart/elastiflow/blob/master/INSTALL.md

  6. 为什么不要在Spring的配置里,配置上XSD的版本号

    为什么不要在Spring的配置里,配置上XSD的版本号?因为如果没有配置版本号,取的就是当前jar里的XSD文件,减少了各种风险.而且这样约定大于配置的方式很优雅.

  7. Linux磁盘空间扩容(LVM)

    Linux磁盘空间扩容(lvm) 随着系统的运行时间增长,业务数据的增长,原有磁盘的空间会存在空间不足情况,导致系统不能正常运行,或者系统管理员磁盘没有完全划完,根据使用者的需求自行划分.那么怎么才能 ...

  8. 【AtCoder】AGC020

    A - Move and Win 题解 看两个人相遇的时候谁先手即可,相遇之后第一个移动的人必输 代码 #include <bits/stdc++.h> #define fi first ...

  9. Codeforces Round #475 (Div. 2) D. Destruction of a Tree

    题意:给你一棵树, 只能删度数为偶数的点, 问你能不能将整个图删完, 如果能输入删除的顺序. 思路:对于一棵树来说, 如果里面的点的个数是偶数个则肯定不可能, 偶数个点有奇数条边,而你每次删只能删偶数 ...

  10. zabbix agent配置文件记录

    一.无论主动还是被动模式都要配置server和linstenPort 二.若要设置主动模式那么要添加ServerActive,若不添加则默认为被动模式