boostrap

框架:把大家需要的功能预先写好到一些文件;

Bootstrap特点:

      特点就是灵活简洁,代码优雅,美观大方;
      其目的是为了让 Web 开发更敏捷;
      是 Twitter 公司的两名前端工程师 Mark Otto 和 Jacob Thornton 在 2011 - 年发起的,并利用业余时间        完成第一个版本的开发;

为什么使用Bootstarp?

  生态圈火,不断地更新迭代;
       提供一套美观大方地界面组件;
       提供一套优雅的 HTML+CSS 编码规范;
      让我们的 Web 开发更简单,更快捷;

安装Bootstrap

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4   <meta charset="UTF-8">
 5   <title>页面标题</title>
 6   <!-- 引入Bootstrap核心样式文件(必须) -->
 7   <link rel="stylesheet" href="css/bootstrap.min.css">
 8   <!-- 引入Bootstrap默认主题样式(可选) -->
 9   <link rel="stylesheet" href="css/bootstrap.theme.min.css">
10   <!-- 你自己的样式或其他文件 -->
11   <link rel="stylesheet" href="example.css">
12 </head>
13 <body>
14   <!-- 你的HTML结构...... -->
15   <!-- 以下代码,如果不使用JS插件则不需要 -->
16   <!-- 由于Bootstrap的JS插件依赖jQuery,so 引入jQuery -->
17   <script src="js/jquery.min.js"></script>
18   <!-- 引入所有的Bootstrap的JS插件 -->
19   <script src="bootstrap.min.js"></script>
20   <!-- 你自己的脚本文件 -->
21   <script src="example.js"></script>
22 </body>
23 </html>

基础的Bootstrap模板

 1 <!DOCTYPE html>
 2 <html lang="en">
 3   <head>
 4     <meta charset="utf-8">
 5     <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 6     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 8     <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
 9     <title>Bootstrap 101 Template</title>
10     <!-- Bootstrap -->
11     <link href="css/bootstrap.min.css" rel="stylesheet">
12     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
13     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
14     <!--[if lt IE 9]>
15       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
16       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
17     <![endif]-->
18   </head>
19   <body>
20     <h1>Hello, world!</h1>
21     <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
22     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
23     <!-- Include all compiled plugins (below), or include individual files as needed -->
24     <script src="js/bootstrap.min.js"></script>
25   </body>
26 </html>

compatible

1 <meta http-equiv="X-UA-Compatible" content="IE=edge">
  • 此属性为文档兼容模式声明,表示如果在IE浏览器下则使用最新的标准渲染当前文档

视口

  • 视口的作用:在移动浏览器中,当页面宽度超出设备,浏览器内部虚拟的一个页面容器,将页面容器缩放到设备这么大,然后展示
  • 目前大多数手机浏览器的视口(承载页面的容器)宽度都是980;
  • 视口的宽度可以通过meta标签设置
  • 此属性为移动端页面视口设置,当前值表示在移动端页面的宽度为设备的宽度,并且不缩放(缩放级别为1)
  • 视口的宽度
  • initial-scale:初始化缩放
  • user-scalable:是否允许用户自行缩放(值:yes/no; 1/0)
  • minimun-scale:最小缩放initial-scale


第三方依赖

原文地址:https://www.cnblogs.com/yangguoe/p/8098717.html