根据被嵌入内容的外部容器的宽度,自动创建一个固定的比例,从而让浏览器自动确定视频或 slideshow 的尺寸,能够在各种设备上缩放。这些规则被直接应用在 <iframe>
、<embed>
、<video>
和 <object>
元素上。
.embed-responsive——指定div为具有响应式特性的嵌入内容的组件;
.embed-responsive-16by9、.embed-responsive-4by3——指定组件内元素宽高比分别为16:9、4:3;
.embed-responsive-item——指定组件内的元素的最终样式与其它属性相匹配;
<!DOCTYPE html> <html lang="zh_CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>饭盒儿——发现身边不一样的世界</title> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> <script src="js/jquery-2.1.3.min.js"></script> <script src="js/bootstrap.min.js"></script> <!-- 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="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <style> </style> </head> <body> <div class="container"> <h3> 具有响应式特性的嵌入内容 </h3> <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="http://www.shydzc.com/home"></iframe> </div> <hr/> <div class="embed-responsive embed-responsive-4by3"> <embed class="embed-responsive-item" src="http://player.youku.com/player.php/sid/XMTI3NjI2MzQ2MA==/v.swf" quality="high" width="350" height="240" align="middle" allowScriptAccess="always" allowFullScreen="true" mode="transparent" type="application/x-shockwave-flash"> </embed> </div> </div> </body> </html>
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/bboyjoe/article/details/47187473