什么是Bootstrap?
- 框架:库 lib library
- jQuery作为一个框架来讲,提供一套比较便捷的操作DOM的方式
- 把大家都需要的功能预先写好到一些文件 这就是一个框架
-
Bootstrap 让我们的 Web 开发更简单,更快捷;
-
注意是 Bootstrap 不是 BootStrap!这是一个词,不是合成词,其含义为:n. 引导指令,引导程序
- Bootstrap 是当下最流行的前端框架(界面工具集);
- 特点就是灵活简洁,代码优雅,美观大方;
- 其目的是为了让 Web 开发更敏捷;
- 是 Twitter 公司的两名前端工程师 Mark Otto 和 Jacob Thornton 在 2011 - 年发起的,并利用业余时间完成第一个版本的开发;
为什么使用Bootstarp?
- 生态圈火,不断地更新迭代;
- 提供一套美观大方地界面组件;
- 提供一套优雅的 HTML+CSS 编码规范;
- 让我们的 Web 开发更简单,更快捷;
注意:
使用 Bootstrap 并不代表不用写 CSS 样式,而是不用写绝大多数大家都会用到的样式
准备
下载Bootstrap
- https://github.com/twbs/bootstrap/releases/download/v3.3.6/bootstrap-3.3.6-dist.zip
- https://github.com/twbs/bootstrap/releases/download/v4.0.0-alpha.2/bootstrap-4.0.0-alpha.2-dist.zip
安装Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>页面标题</title>
<!-- 引入Bootstrap核心样式文件(必须) -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- 引入Bootstrap默认主题样式(可选) -->
<link rel="stylesheet" href="css/bootstrap.theme.min.css">
<!-- 你自己的样式或其他文件 -->
<link rel="stylesheet" href="example.css">
</head>
<body>
<!-- 你的HTML结构...... -->
<!-- 以下代码,如果不使用JS插件则不需要 -->
<!-- 由于Bootstrap的JS插件依赖jQuery,so 引入jQuery -->
<script src="js/jquery.min.js"></script>
<!-- 引入所有的Bootstrap的JS插件 -->
<script src="bootstrap.min.js"></script>
<!-- 你自己的脚本文件 -->
<script src="example.js"></script>
</body>
</html>
Bootstrap文档
基础的Bootstrap模板
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<h1>Hello, world!</h1>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Compatible
<meta http-equiv="X-UA-Compatible" content="IE=edge"&