Bootstrap基本框架

来源:互联网 发布:fedora linux镜像下载 编辑:程序博客网 时间:2024/06/06 01:09

基本框架

<!DOCTYPE html><html>   <head>      <meta charset="utf-8">      <meta http-equiv="X-UA-Compatible" content="IE=edge">      <meta name="viewport" content="width=device-width, initial-scale=1"><!-- maximum-scale=1.0 与 user-scalable=no 一起使用。这样禁用缩放功能后,用户只能滚动屏幕,就能让您的网站看上去更像原生应用的感觉。--!> <!--<meta name="viewport" content="width=device-width,                                     initial-scale=1.0,                                     maximum-scale=1.0,                                    user-scalable=no">  --!>       <title>Bootstrap 模板</title>      <!-- 引入 Bootstrap -->      <link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">      <!-- HTML5 Shim 和 Respond.js 用于让 IE8 支持 HTML5元素和媒体查询 -->      <!-- 注意: 如果通过 file://  引入 Respond.js 文件,则该文件无法起效果 -->      <!--[if lt IE 9]>         <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>         <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>      <![endif]-->   </head>   <body>      <h1>Hello, world!</h1>      <!-- jQuery (Bootstrap 的 JavaScript 插件需要引入 jQuery) -->      <script src="https://code.jquery.com/jquery.js"></script>      <!-- 包括所有已编译的插件 -->      <script src="js/bootstrap.min.js"></script>   </body></html>

响应式图片

<img src="..." class="img-responsive" alt="响应式图像">

其中img-responsive的class属性为:

.img-responsive {  display: inline-block;  height: auto;  max-width: 100%;}

display: inline-block元素表明:相对于它周围的内容以内联形式呈现,但与内联不同的是,这种情况下我们可以设置宽度和高度。

设置 height:auto,相关元素的高度取决于浏览器。

设置 max-width 为 100% 会重写任何通过 width 属性指定的宽度。这让图片对响应式布局的支持更友好。

原创粉丝点击