首先,想要了解 Boostrap 的文档结构,需要在官网先把它下载到本地。Bootstrap下载地址如下:
Bootstrap 下载地址:http://v3.bootcss.com/ (选择生产环境即可,v3.3.7最新版本)
用于生产环境的bootstrap解压后,目录呈现这样的结构: bootstrap/ ├── css/ │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ └── bootstrap-theme.min.css ├── js/ │ ├── bootstrap.js │ └── bootstrap.min.js └── fonts/ ├── glyphicons-halflings-regular.eot ├── glyphicons-halflings-regular.svg ├── glyphicons-halflings-regular.ttf ├── glyphicons-halflings-regular.woff └── glyphicons-halflings-regular.woff2 主要分为三大核心目录:css(样式)、js(脚本)、fonts(字体)。 1.css 目录中有四个 css 后缀的文件,其中包含 min 字样的,是压缩版本,一般使用这个;不包含的属于没有压缩的,可以学习了解 css 代码的文件;而 map 后缀的文件则是css 源码映射表,在一些特定的浏览器工具中使用。 2.js 目录包含两个文件,是未压缩和压缩的 js 文件。 3.fonts 目录包含了不同后缀的字体文件。
我们创建一个 HTML5 的页面,并且将 Bootstrap 的核心文件引入,然后测试是否正常显示。
<!DOCTYPE html> <html lang="zh-cn"><head> <meta charset="UTF-8"> <title>Bootstrap 介绍</title> <link rel="stylesheet" href="css/bootstrap.min.css"> </head> <body> <button class="btn btn-info">Bootstrap</button> <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html> 注意:引入3个文件,地址一定要正确不然没有效果,jquery.min.js库的引入必须在bootstrap.min.js前面,因为bootstrap依赖jquery。
