diff --git a/Bootstrap/1 getting-started.md b/Bootstrap/1 getting-started.md new file mode 100644 index 00000000..ba4e1d62 --- /dev/null +++ b/Bootstrap/1 getting-started.md @@ -0,0 +1,197 @@ +## 什么是BOOTSTRAP + +### 1)BOOTSTRAP概述 + +Bootstrap 是 Twitter 公司开发的一个基于 HTML、CSS、JavaScript 的技术框架,符合 HTML、CSS 规范,且代码简介、视觉优美。 + +Bootstrap 集合 HTML、CSS 和 JavaScript,使用了最新的浏览器技术,为实现快速开发提供了一套前端工具包。使用 Bootstrap 不仅可以构建出非常优雅的 HTML 页面,而且占用资源非常少,使用 gzip 压缩后大小仅用 10KB。并且 Bootstrap 在跨浏览器兼容方面表示也很好。 + +### 2)选择BOOTSTRAP的理由 + +* Bootstrap 的 HTML 是基于 HTML5 的最新技术。 +* Bootstrap 可以快速实现响应式页面。 +* Bootstrap 集成了非常友好的 CSS 样式表,对于非设计人员也可以制作出很漂亮的网页。 + +### 3)BOOTSTRAP提供的功能 + +根据 Bootstrap 官网提供的文档,可以知道 Bootstrap 分为以下几个模块: + +* 全局 CSS 样式:提供了格栅系统、表格、表单、按钮等集成样式。 +* 组件:提供了下拉菜单、输入框、导航、列表组等组件。 +* 插件:提供了模态框、滚动监听、警告框、弹出框等插件。 + +### 4)BOOTSTRAP的版本变化 + +* 2011年8月,Twitter 推出了 Bootstrap 1 版本,该工具由 Twitter 的设计师 Mark Otto 和 Jacob Thornton 合作完成。 +* 2012年1月,Twitter 推出了 Bootstrap 2 版本。相比 Bootstrap 1 版本,Bootstrap 2 添加了响应式设计、采用 12 栏栅格布局,并且清晰地划分出 CSS 布局、组件和插件等功能。 +* 2013年8月,Twitter 推出了 Bootstrap 3 版本。在这个版本中,采用移动优先和更好的盒子模型等。并且官方不再支持 IE 7及以下版本的浏览器。 +* 目前,Bootstrap 4 只是开发者预览版。 + +## 下载BOOTSTRAP + +### 1)Bootstrap 官网及下载地址 + +* Bootstrap 官网:[http://getbootstrap.com](http://getbootstrap.com) +* Bootstrap 下载地址:[http://getbootstrap.com/getting-started/#download](http://getbootstrap.com/getting-started/#download) + +### 2)Bootstrap 使用的两种方式 + +* 将 Bootstrap 提供的压缩包下载,导入到工程目录中使用。 +* 使用 CDN 加速服务,例如以下内容: + +```html + + + + + + + + + + + +``` + +### 3)Bootstrap 目录结构及说明 + +下载压缩包之后,将其解压缩到任意目录即可看到以下(压缩版的)目录结构: + +``` +bootstrap/ +├── css/ 样式库 +│ ├── bootstrap.css 样式文件 +│ ├── bootstrap.css.map +│ ├── bootstrap.min.css 压缩后的样式文件 +│ ├── bootstrap-theme.css 主题文件 +│ ├── bootstrap-theme.css.map +│ └── bootstrap-theme.min.css 压缩后的主题文件 +├── js/ 核心 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 +``` + +## 对浏览器的支持情况 + +### 1)目前支持的浏览器 + +| | Chrome | Firefox | Internet Explorer | Opera | Safari | +| --- | --- | --- | --- | --- | --- | +| Android | 支持 | 支持 | N/A | 不支持 | N/A | +| IOS | 支持 | N/A | N/A | 不支持 | 支持 | +| Mac OS X | 支持 | 支持 | N/A | 支持 | 支持 | +| Windows | 支持 | 支持 | 支持 | 支持 | 不支持 | + +### 2)IE 8及之前版本的兼容 + +* 对 HTML 5 提供的新元素,需要通过 html5shiv.js 库进行兼容。 +* 对 CSS 3 提供的媒体查询,需要通过 respond.js 库进行支持。 + +需要在使用 Bootstrap 框架的页面 head 元素中,插入以下内容: + +```html + + + +``` + +### 3)IE 兼容模式 + +Bootstrap 不支持 IE 古老的兼容模式。为了让 IE 浏览器运行最新的渲染模式下,建议将此 `` 元素加入到页面中: + +```html + +``` + +### 4)国产浏览器高速模式 + +国内浏览器厂商一般都支持兼容模式(即 IE 内核)和高速模式(即 webkit 内核),不幸的是,所有国产浏览器都是默认使用兼容模式,这就造成由于低版本 IE (IE8 及以下)内核让基于 Bootstrap 构建的网站展现效果很糟糕的情况。 + +将下面的 `` 元素加入到页面中,可以让部分国产浏览器默认采用高速模式渲染页面: + +```html + +``` + +## box-sizing + +Bootstrap 默认使用的盒子模型是 border-box,可能会和一些第三方组件冲突。 + +为了避免 Bootstrap 设置的全局盒模型所带来的影响,可以重置单个页面元素或覆盖整个区域的盒模型。 + +* 覆盖单个页面元素 + +```css +/* 通过 CSS 代码覆盖单个页面元素的盒模型 */ +.element { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +``` + +* 重置整个区域 + +```css +/* 通过 CSS 代码重置整个区域 */ +.reset-box-sizing, +.reset-box-sizing *, +.reset-box-sizing *:before, +.reset-box-sizing *:after { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +``` + +## 基本模板 + +Bootstrap 提供了一个最基本的 HTML 模板,基于这个模板开始实现 Bootstrap 响应式页面。 + +```html + + +
+ + + + + + + +This is a template for a simple marketing or informational website. It includes a large callout called a + jumbotron and three supporting pieces of content. Use it as a starting point to create something more + unique.
+Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris + condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis + euismod. Donec sed odio dui.
+ +Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris + condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis + euismod. Donec sed odio dui.
+ +Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula + porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut + fermentum massa justo sit amet risus.
+ +Left aligned text.
+Center aligned text.
+Right aligned text.
+Justified text.
+No wrap text.
+Lowercased text.
+Uppercased text.
+Capitalized text.
+提示信息
+首选项
+成功
+信息
+警告
+危险
+