背景
给出一个使用Bootstrap做的网页的标准示例。
代码及解释
<!doctype html><!-- 告诉浏览器该文档是HTML5文档 -->
<html>
<head>
<meta charset="utf-8"><!-- 告诉浏览器网页使用的字符集为utf-8以便支持中文 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"><!-- 当浏览器为IE时,指示浏览器使用最高的仿真版本来显示本网页 -->
<meta name="viewpoint" content="width=device-width,initial-scale=1"><!-- 页面宽度为设备宽度,且缩放比例为100% -->
<title>此处为网页标题</title>
<link href="css/bootstrap.min.css" rel="stylesheet"><!-- 导入Bootstrap样式表 -->
<!-- 接下来四行是为了保证IE8和更低版本的兼容性,相关js文件可以从网上下载 -->
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- 此处放置网页具体内容 -->
<script src="js/jquery.min.js"></script><!-- Bootstrap一些功能依赖于jQuery -->
<script src="js/bootstrap.min.js"></script><!-- 导入Bootstrap相关js -->
</body>
</html>
css及js版本建议
- Bootstrap 3.3.1
- jQuery 1.11.1
- html5shiv 3.7.2
- respond 1.4.2