Bootstrap框架 简单使用
Bootstrap框架 简单使用
什么是Bootstrap
"""
Bootstrap是美国Twitter公司的设计师Mark Otto和Jacob Thornton合作基于HTML、CSS、JavaScript
开发的简洁、直观、强悍的[前端]开发框架,使得 Web 开发更加快捷。Bootstrap提供了优雅的HTML和CSS规范,
它即是由动态CSS语言Less写成。Bootstrap一经推出后颇受欢迎,一直是GitHub上的热门开源项目,
包括NASA的MSNBC(微软全国广播公司)的Breaking News都使用了该项目,国内一些移动开发者较为熟悉的框架,
如WeX5前端开源框架等,也是基于Bootstrap源码进行性能优化而来。
"""
下载 Bootstrap
项目结构
#目录结构
bootstrap/
├── css/
│ ├── bootstrap.css #开发环境下的css样式
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css #生产环境下的css样式(推荐)
│ ├── bootstrap.min.css.map
│ ├── bootstrap-theme.css
│ ├── bootstrap-theme.css.map
│ ├── bootstrap-theme.min.css
│ └── bootstrap-theme.min.css.map
├── js/
│ ├── bootstrap.js #开发环境下的js样式
│ └── bootstrap.min.js #生产环境下的js样式(推荐)
└── fonts/ #字体相关
├── glyphicons-halflings-regular.eot
├── glyphicons-halflings-regular.svg
├── glyphicons-halflings-regular.ttf
├── glyphicons-halflings-regular.woff
└── glyphicons-halflings-regular.woff2
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 移动设备优先 -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
<!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<!--兼容移动设备-->
<![endif]-->
</head>
<body>
<h1>你好,世界!</h1>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
</body>
</html>
Bootstrap 简单使用
根据下面样式用Bootstrap 实现①
导入 Bootstrap
去 Bootstrap 复制需要的样式代码
根基自己需求进行修改
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>信息收集卡
<small>共三步</small>
</h1>
</div>
</div>
<script src="jquery.js"></script>
<script src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
继续拷贝(根据自己需求按照进行修改)
<!--进度条代码-->
<div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0"
aria-valuemax="100" style="width: 40%">
<span class="sr-only">40% Complete (success)</span>
</div>
</div>
修改
<div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="60" aria-valuemin="0"
aria-valuemax="100" style="width: 33%;">
1/3
</div>
</div>
经过一系列拷贝改动之后 (代码)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container"> <!-- 布局容器 -->
<div class="page-header"> <!-- 页头 -->
<h1>信息收集卡
<small>共三步</small> <!-- 小字体显示 -->
</h1>
</div>
<div class="progress"> <!-- 绿色进度条 -->
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="60" aria-valuemin="0"
aria-valuemax="100" style="width: 33%;"> <!-- style="width:xx%; 调整进度% -->
1/3 <!-- 进度条显示数值 -->
</div>
</div>
<div class="panel panel-primary"> <!-- 蓝色面板 -->
<div class="panel-heading">
<h3 class="panel-title">基本信息 <!-- 面板标题 --><span class="glyphicon glyphicon-pushpin pull-right"><!-- 图标 pull-right 右浮 --></span>
</h3>
</div>
<div class="panel-body"> <!-- 面板内容 -->
<div class="row"> <!-- 栅格每行 -->
<div class="col-md-4 col-md-offset-1"> <!-- col-md-4栅格每行占4列 col-md-offset-1往右偏一列 -->
<form class="form-horizontal"> <!-- 水平排列的form表单 -->
<div class="form-group"> <!-- div边距样式 -->
<label for="username" class="col-sm-2 control-label">姓名</label><!-- 关联input框 -->
<div class="col-sm-10">
<input type="text" class="form-control" id="username" placeholder="姓名">
<!-- input框 class="form-control"样式 框内显示placeholder="姓名" -->
</div>
</div>
<div class="form-group">
<label for="phone" class="col-sm-2 control-label">手机</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="phone" placeholder="手机">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">邮箱</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="email" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="headpic" class="col-sm-2 control-label">头像</label>
<div class="col-sm-10">
<input type="file" id="headpic"> <!-- type="file"选择文件 id="headpic"样式 -->
<p class="help-block">只支持png\jpg\gif等格式的文件</p> <!-- 提示文本 -->
</div>
</div>
<div class="form-group">
<label for="headpic" class="col-sm-2 control-label">属性</label>
<div class="col-sm-10">
<div class="radio"> <!-- 圆圈选择样式 -->
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1"
checked>我是一个好人<!-- type="radio"圆圈选择 -->
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option1"
checked>我是一个好人
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios3" value="option1"
checked>我是一个好人
</label>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<button class="btn btn-success pull-right">下一步</button><!-- class="btn btn-success pull-right"蓝色按钮 右浮 -->
</div>
<script src="jquery.js"></script>
<script src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
大功告成
根据下面样式用Bootstrap 实现②
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>Bootstrap 101 Template</title>
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
<style>
.cc {
margin-top: 20px !important;
}
table td {
text-align: center;
height: 30px;
padding-top: 10px;
}
</style>
<!-- 上边距 -->
<!-- 列表字体样式 -->
</head>
<body>
<nav class="navbar navbar-inverse"><!-- 导航条 class="navbar navbar-inverse"黑色导航-->
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container"><!-- 布局容器 -->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3><!-- 列表标题 -->
</div>
<div class="panel-body">
<div class="clearfix"><!-- 清除浮动 -->
<form class="form-inline pull-left"> <!-- form表单 行内 左浮 -->
<div class="form-group">
<input type="email" class="form-control" id="exampleInputEmail2" placeholder="搜索">
</div>
<button type="submit" class="btn btn-primary">搜索</button><!-- btn btn-primary蓝色按钮 -->
</form>
<button class="btn btn-success pull-right">添加</button><!-- btn btn-primary绿色按钮 -->
</div>
<table class="table table-bordered table-striped table-hover cc"><!-- 列表 带表格带条纹带鼠标悬浮效果 -->
<thead>
<tr>
<th>#</th>
<th>name</th>
<th>age</th>
<th>sex</th>
<th>hobby</th>
<th>operation</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>小猪佩奇</td>
<td>8</td>
<td>不详</td>
<td>不知道</td>
<td>
<button class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-pencil"></span>编辑<!-- btn-warning btn-sm橙色按钮小 -->
</button>
<button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-remove"></span>删除<!-- btn-danger btn-sm红色按钮小 -->
</button>
</td>
</tr>
<tr>
<td>1</td>
<td>小猪佩奇</td>
<td>8</td>
<td>不详</td>
<td>不知道</td>
<td>
<button class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-pencil"></span>编辑
</button>
<button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-remove"></span>删除
</button>
</td>
</tr>
<tr>
<td>1</td>
<td>小猪佩奇</td>
<td>8</td>
<td>不详</td>
<td>不知道</td>
<td>
<button class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-pencil"></span>编辑
</button>
<button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-remove"></span>删除
</button>
</td>
</tr>
<tr>
<td>1</td>
<td>小猪佩奇</td>
<td>8</td>
<td>不详</td>
<td>不知道</td>
<td>
<button class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-pencil"></span>编辑
</button>
<button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-remove"></span>删除
</button>
</td>
</tr>
<tr>
<td>1</td>
<td>小猪佩奇</td>
<td>8</td>
<td>不详</td>
<td>不知道</td>
<td>
<button class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-pencil"></span>编辑
</button>
<button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-remove"></span>删除
</button>
</td>
</tr>
</tbody>
</table>
<nav aria-label="Page navigation" class="pull-right"><!-- 分页插件 -->
<ul class="pagination">
<li>
<a href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li>
<a href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
<div>
</div>
</div>
</body>
</html>
表格格式
<table>
<thead>
<tr>
<th>标题</th>
</tr>
</thead>
<tbody>
<tr>
<td>行内容</td>
</tr>
</tbody>
</table>
Bootstrap 按钮颜色 尺寸
<!-- 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>
Bootstrap框架 简单使用的更多相关文章
- Bootstrap框架的学习(一)
一.Bootstrap框架介绍 Bootstrap是一个非常优秀的前端UI框架,一个轻量级的UI前端框架,是基于HTML+CSS+JavaScript的框架. 二.简单介绍 Bootstrap框架是属 ...
- Web前端学习笔记:Bootstrap框架
很久之前就有很多人给我推荐twitter的Bootstrap框架,但是直到前几天我才真正学习了下Bootstrap,的确是相当棒的框架,至少从视觉体验上超越了很多以前碰到了前端UI框架.今天我要聊聊B ...
- BootStrap框架
简介: Bootstrap,来自 Twitter,是目前很受欢迎的前端框架.Bootstrap 是基于 HTML.CSS.JAVASCRIPT 的,它简洁灵活,使得 Web 开发更加快捷,是一个CSS ...
- Bootstrap框架(基础篇)之按钮,网格,导航栏,下拉菜单
一,按钮 注意:虽然在Bootstrap框架中使用任何标签元素都可以实现按钮风格,但个人并不建议这样使用,为了避免浏览器兼容性问题,个人强烈建议使用button或a标签来制作按钮. 框架中提供了基础按 ...
- Bootstrap框架(基础篇)之列表,表格,表单
继续上篇的基础部分延伸,主要说一下列表,表格,表单相关Bootstrap框架变化以及基础知识. 1.列表篇 除了HTML提供的三种基本列表样式: 无序列表 <ul> <li>… ...
- Bootstrap框架(基础篇)
本文引用慕课网http://www.imooc.com/learn/141 作者大漠 讲的很详细,我没有全篇都引用,其中很多是添加了自己的一些理解. Bootstrap框架是基于JQuery 所以 ...
- Bootstrap 框架 栅格布局系统设计原理
如果你是初次接触Bootstrap,你一定会为它的栅格布局感到敬佩.事实上,这个布局系统提供了一套响应式的布局解决方案. 既然这么好用,那他是如何用CSS来实现的呢? 我特意去Bootstrap官方下 ...
- UI设计实战篇——利用Bootstrap框架制作查询页面的界面
Bootstrap框架是一个前端UI设计的框架,它提供了统一的UI界面,简化了设计界面UI的过程(缺点是定制了界面,调整的余地不是太大).尤其是现在的响应时布局(我的理解是页面根据不同的分辨率,采用不 ...
- bootstrap框架应用
---------------------------------------------------------------bootstrap---------------------------- ...
随机推荐
- Mybatis(上)
Mybatis 一.MyBatis 简介 1. MyBatis作用 MyBatis 是支持定制化 SQL.存储过程以及高级映射的优秀的持久层框架. MyBatis 避免了几乎所有的 JDBC 代码和手 ...
- 正则表达式在线分析 regex online analyzer
https://regexper.com/#%2F%5B0-9%5D%5Cs%5B0-9%5D%2F https://regexper.com/ http://regexone.com/lesson/ ...
- The fileSyncDll.ps1 is not digitally signed. You cannot run this script on the current system.
https://www.opentechguides.com/how-to/article/powershell/105/powershel-security-error.html Unblockin ...
- 【winform】主窗体多线程给子窗体传值
1.主窗体多线程给子窗体传值 解决方案:主要使用委托,因为会出现跨线程错误 主窗体 public FormMain() { InitializeComponent(); //background th ...
- SpringBoot入门-概念(一)
SpringBoot是什么 Spring boot是一个构建在Spring框架之上.以一种更加简单快捷的方式来配置和运行web应用程序的开源框架. 为什么用SpringBoot 可以解决普通的java ...
- 几个支持 FreeSWITCH 的网络电话的安装与使用(linphone、MicroSIP、Sipdroid)
Ubuntu 安装 Linphone 安装命令 apt-get install linphone 安装完成后,在应用程序 --> 互联网 下就能看到 linphone,打开后注册 注意:linp ...
- PP篇11 增、改生产订单组件BAPI
增.改生产订单组件BAPI BAPI_ALM_ORDER_MAINTAIN USE BAPI_ALM_ORDER_MAINTAIN TO CREATE OR CHANGE PM WORK ORDER ...
- knuth洗牌算法
首先来思考一个问题: 设计一个公平的洗牌算法 1. 看问题,洗牌,显然是一个随机算法了.随机算法还不简单?随机呗.把所有牌放到一个数组中,每次取两张牌交换位置,随机 k 次即可. 如果你的答案是这样, ...
- 在webstorm里使用git
1,设置git 打开webstorm软件,找到file下面的settings(设置) 打开设置对话窗,找到version control的子级目录git,路径path输入git安装目录下bin目录里的 ...
- mysql 按照两个字段之和进行排序
SELECT *,zan_num+fake_zan_num show_zan FROM `tf_news` order by show_zan desc TP实现 $news = M('news'); ...