原文地址: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. nodejs抓取别人家的页面的始末

    内容:分析并获取页面调取数据的API(接口),并跨域获取数据保存在文档中(nodejs做代理-CORS) 事由以及动机 2015年9月份全国研究生数学建模竞赛的F题,旅游线路规划问题.其中需要自己去查 ...

  2. mac zsh环境配置java_home环境变量

    用zsh,修改-/.zshrc 修改这些文件之后,重修打开terminal,配置不会丢 首先确保已经安装了jdk: ## check the present running java which ja ...

  3. 【linux】crontab无效解决办法

    参考来源:http://www.tennfy.com/3088.html 问题: 我在crontab中添加了一条定时任务 * * * sh test.sh 出乎意料的是,该定时任务并没有执行.可是我直 ...

  4. Archlinux安装笔记

    由于自己的电脑上暂时还没有足够的硬盘空间,所以先暂用虚拟机来装一下Archlinux,在安装好VMware Workstation之后,从Archlinux官网的下载页面下载到了最新的镜像文件.之后新 ...

  5. hdu 5003 模拟水题 (2014鞍山网赛G题)

    你的一系列得分 先降序排列 再按0.95^(i-1)*ai 这个公式计算你的每一个得分 最后求和 Sample Input12530 478Sample Output984.1000000000 # ...

  6. CSS3&HTML5各浏览器支持情况一览表

    http://fmbip.com/ CSS3性质(CSS3 Properties) 平台 MAC WIN 浏览器 CHROME FIREFOX OPERA SAFARI CHROME FIREFOX ...

  7. Net WebAPI2

    SwaggerUI ASP.Net WebAPI2   目前在用ASP.NET的 WebAPI2来做后台接口开发,在与前台做测试的时候,总是需要发送一个demo给他,但是这样很麻烦的,他还有可能记不住 ...

  8. 入门NodeJS

    入门NodeJS https://www.cnblogs.com/dotnetcrazy/p/10118756.html NodeJS 1.环境配置 之前讲ES6的时候有提过一部分Node的知识,简单 ...

  9. sed匹配多行替换

    sed -i '/aaa/{:a;n;s/123/xyz/g;/eee/!ba}' yourfile 如题:aaa123123123123123eee怎么匹配aaa~eee(开始结束字符串确定),然后 ...

  10. P2858 [USACO06FEB]奶牛零食Treats for the Cows

    P2858 [USACO06FEB]奶牛零食Treats for the Cows区间dp,级像矩阵取数, f[i][i+l]=max(f[i+1][i+l]+a[i]*(m-l),f[i][i+l- ...