Python-bootstrap
1 引入
如果想要用到BootStrap提供的js插件,那么还需要引入jQuery框架,因为BootStrap提供的js插件是依赖于jQuery的
<link type="text/css" rel="stylesheet" href="../css/bootstrap.css">
<script type="text/javascript" src="../bootstrap.js"></script>
<script type="text/javascript" src="../jquery-1.12.4.min.js"></script>
2 容器
- 固定宽度:.container
- 流式布局:.container-fluid
3 响应式布局
- 超小屏幕:小于 768px
- 小屏幕:大于等于 768px
- 中等屏幕:大于等于 992px
- 大屏幕:大于等于 1200px
为什么要进行响应式开发?
随着移动设备的流行,网页设计必须要考虑到移动端的设计。同一个网站为了兼容PC端和移动端显示,就需要进行响应式开发。
什么是响应式?
利用媒体查询,让同一个网站兼容不同的终端(PC端、移动端)呈现不同的页面布局。
用到的技术:
CSS3@media查询
用于查询设备是否符合某一特定条件,这些特定条件包括屏幕尺寸、是否可触摸、屏幕精度、横屏竖屏等信息。
常见属性:
- device-width, device-height 屏幕宽、高
- width,height 渲染窗口宽、高
- orientation 设备方向
- resolution 设备分辨率
语法:
@media mediatype and|not|only (media feature) {
CSS-Code;
}
不同的媒体使用不同的stylesheet
<link rel="stylesheet" media="mediatype and|not|only (media feature)" href="mystylesheet.css">
viewport
手机浏览器是把页面放在一个虚拟的"窗口"(viewport)中,通常这个虚拟的"窗口"(viewport)比屏幕宽,这样就不用把每个网页挤到很小的窗口中(这样会破坏没有针对手机浏览器优化的网页的布局),用户可以通过平移和缩放来看网页的不同部分。
设置viewport
一个常用的针对移动网页优化过的页面的 viewport meta 标签大致如下:
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″>
- width:控制 viewport 的大小,可以指定的一个值,如果 600,或者特殊的值,如 device-width 为设备的宽度(单位为缩放为 100% 时的 CSS 的像素)。
- height:和 width 相对应,指定高度。
- initial-scale:初始缩放比例,也即是当页面第一次 load 的时候缩放比例。
- maximum-scale:允许用户缩放到的最大比例。
- minimum-scale:允许用户缩放到的最小比例。
- user-scalable:用户是否可以手动缩放。
Bootstrap的栅格系统
- container
- row
- column
注意事项: 使用Bootstrap的时候不要让自己的名字与Bootstrap的类名冲突。
4 栅格系统
1、概念
将父级可用宽度(content)均分为12等份
0. 包含在container里面
1. 每一行(row)均分成12列(col-xx-**)必须放在row中),
2. 每一个标签可以自定义占的列数(col-xx-**)
列偏移
列排序
2、列比
- 超小屏幕:.col-xs-*
- 小屏幕:.col-sm-*
- 中等屏幕:.col-md-*
- 大屏幕:.col-lg-*
v-hint:只设置小屏列比会影响大屏列比;只设置大屏列比小屏时会撑满屏幕
3、行
<div class="row"></div>
...
<div class="row"></div>
4、列偏移
- 超小屏幕:.col-xs-offset-*
- 小屏幕:.col-sm-offset-*
- 中等屏幕:.col-md-offset-*
- 大屏幕:.col-lg-offset-*
5 常用组件
字体图标
优点:
size小
放大不失真
可以随字体颜色变化而变化
1. Bootstrap自带的
<span class='glyphicon glyphicon-heart'></span>
2. font Awesome
<i class="fa fa-heart"></i>
http://www.fontawesome.com.cn/
下拉菜单
按钮组
输入框俎
导航
分页
标签和徽章
页头
缩率图
进度条
补充:滚动的进度条
var $d1 = $("#d1");
var width = 0;
var theID = setInterval(setValue, 200);
function setValue() {
if (width === 100) {
clearInterval(theID);
} else {
width++;
$d1.css("width", width+"%").text(width+"%");
}
}
6. Bootstrap常用组件
7. Bootstrap常用插件
1. 模态框
模态框的HTML代码放置的位置
务必将模态框的HTML代码放在文档的最高层级内(也就是说,尽量作为 body 标签的直接子元素),以避免其他组件影响模态框的展现和/或功能。
<!-- 触发模态框的按钮 -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button> <!-- 模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
注意:
- 通过为模态框设置
.bs-example-modal-lg和.bs-example-modal-sm来控制模态框的大小。 - 通过
.fade类来控制模态框弹出时的动画效果(淡入淡出效果)。 - 通过在
.modal-bodydiv中设置.row可以使用Bootstrap的栅格系统。
2. 轮播图
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol> <!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div> <!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
可以在为图片添加介绍信息:

<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
<h3>...</h3>
<p>...</p>
</div>
</div>

方法:
设置切换间隔为2秒,默认是5秒。
$('.carousel').carousel({
interval: 2000
})
8. 其他插件
1. SweetAlert for bootstrap
https://lipis.github.io/bootstrap-sweetalert/
REFERENCE-LIWENZHOU :http://www.cnblogs.com/liwenzhou/p/8214637.html
Python-bootstrap的更多相关文章
- ez_setup.py(安装python下setuptools用)
#!python"""Bootstrap setuptools installation If you want to use setuptools in your pa ...
- selenium python 环境搭建(64位 windows)
之前写了同样的文章,可是后来自己按照给文章再次搭建环境当搭建环境成功后却发现还是无法用.使用from selenium import webdriver,在run的时候却出现ImportError: ...
- boost.python编译及演示样例
欢迎转载,转载请注明原文地址:http://blog.csdn.net/majianfei1023/article/details/46781581 linux编译boost的链接:http://bl ...
- Python - excel 详解
安装 pip install xlrd # 读xlspip install xlwt # 写xlspip install xlutils # 改写xls 读取 Excel ...
- Python打包上传
你可以用pip导出你的dependency: $ pip freeze > requirements.txt 然后在通过以下命令安装dependency: pip install -r requ ...
- python pip ez_setup.py
#!/usr/bin/env python """Bootstrap setuptools installation To use setuptools in your ...
- 用Buildout来构建Python项目
用Buildout来构建Python项目 什么是Buildout (Remixed by Matt Hamilton, original from http://xkcd.com/303) Bui ...
- Ninja - chromium核心构建工具
转自:http://guiquanz.me/2014/07/28/a_intro_to_Ninja/ Ninja - chromium核心构建工具Jul 28, 2014 [在线编辑] 缘由 经过上次 ...
- 使用buildbot实现持续集成(转载)
转载自:http://www.oschina.net/p/buildbot 使用 Buildot 实现持续集成 使用基于 Python 的工具实现持续集成的理论与实践 牛仔式编码的日子在大多数组织中早 ...
- [置顶] 教你如何搭建RobotFramework环境
看到这篇文章的朋友,相信已经知道RobotFramework是干什么的了,我这里就不再赘述了. 搭建步骤: 1. 下载安装Python,下载地址http://www.python.org/getit/ ...
随机推荐
- oi程序提交注意:bool
比如我一个程序用了bool类型(#include<stdbool.h>) 在poj以c的方式提交不通过显示Compile Error,而用gcc的方式提交通过了, 也许其它的#includ ...
- vcf文件(call variants得来的)怎么看变异是纯合还是杂合的
如下图片所示: 对于位置为48245131的allele来说,REF为A,ALT为C 想确定变异到底是纯合还是杂合,即两条染色体是否同时发生了变异,则看GT,GT对应的数值为0/1,说明该变异为杂合: ...
- (递推 大整数) Children’s Queue hdu1297
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- P3594 [POI2015]WIL-Wilcze doły
P3594 [POI2015]WIL-Wilcze doły 题目描述 给定一个长度为n的序列,你有一次机会选中一段连续的长度不超过d的区间,将里面所有数字全部修改为0.请找到最长的一段连续区间,使得 ...
- Shell标准输出、标准错误
shell中可能经常能看到:>/dev/null 2>&1 eg:sudo kill -9 ps -elf |grep -v grep|grep $1|awk '{print $4 ...
- JAVA记录-SpringMVC scope属性的两种模式
singleton作用域:当把一个Bean定义设置为singleton作用域是,Spring IoC容器中只会存在一个共享的Bean实例,并且所有对Bean的请求,只要id与该Bean定义相匹配,则只 ...
- TCP和UDP的区别和优缺点
1.TCP与UDP区别总结: 1.TCP面向连接(如打电话要先拨号建立连接);UDP是无连接的,即发送数据之前不需要建立连接2.TCP提供可靠的服务.也就是说,通过TCP连接传送的数据,无差错,不丢失 ...
- mysql alter 用法,修改表,字段等信息
一: 修改表信息 1.修改表名 alter table test_a rename to sys_app; 2.修改表注释 alter table sys_application comment '系 ...
- C# Dictionary序列化/反序列化
[Serializable] public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue& ...
- 14. Spring Boot的 thymleaf公共页抽取
5).CRUD-员工列表实验要求:1).RestfulCRUD:CRUD满足Rest风格:URI: /资源名称/资源标识 HTTP请求方式区分对资源CRUD操作 普通CRUD(uri来区分操作) ...
