本文概述
响应式帮助程序实用程序允许浏览器根据其包含块的宽度来确定视频或幻灯片的尺寸,以使其能够在任何设备上正确缩放。
你必须直接在<iframe>,<embed>,<video>和<object>元素上应用规则;要与其他属性的样式匹配时,可以选择使用显式后代类.embed-response-item。
注意:你不需要在
句法:
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="//www.youtube.com/embed/zpOULjyy-n8?rel=0" allowfullscreen></iframe>
</div>
You can customize aspect ratios with modifier classes:
<!-- 21:9 aspect ratio -->
<div class="embed-responsive embed-responsive-21by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 1:1 aspect ratio -->
<div class="embed-responsive embed-responsive-1by1">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
响应式浮动
这些实用程序类用于使用CSS float属性基于当前视口大小向左或向右浮动元素,或禁用浮动。包括!important以避免特异性问题。
它们使用与网格系统相同的视口宽度断点。
也有两种类似的无响应Sass mixins(向左浮动和向右浮动)。
句法:
<div class="float-left">Float left on all viewport sizes</div><br>
<div class="float-right">Float right on all viewport sizes</div><br>
<div class="float-none">Don't float on all viewport sizes</div><br>
<div class="float-sm-left">Float left on viewports sized SM (small) or wider</div><br>
<div class="float-md-left">Float left on viewports sized MD (medium) or wider</div><br>
<div class="float-lg-left">Float left on viewports sized LG (large) or wider</div><br>
<div class="float-xl-left">Float left on viewports sized XL (extra-large) or wider</div><br>
如何使用它:
// Related simple non-responsive mixins
.element {
@include float-left;
}
.another-element {
@include float-right;
}
评论前必须登录!
注册