TwBs v4 用户注意事项:替换col-xs-*
为col-*
.
原始答案(TwBs v3):您的col-*
课程非常适用。
而且 Bootstrap 是移动优先的,这意味着col-xs-7
不需要col-sm-7
,col-md-7
或更高版本。
You can check it by selecting the elements and watching their bounding-rect-box'es (which are highlighted by most dev-tools). However, this doesn't stop <iframe>
elements (which have hardcoded width
and height
properties) to overflow the widths of their parents. If you want to override that, you need to set their width
to 100%
:
iframe {
display: block;
width: 100%;
}
See it working:
iframe {
display: block;
width: 100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<div class="row">
<div class="col-xs-7" id="introduction">
<p>The project uses Machine Learning to identify the waste items. A brief introduction about the Machine Learning technology is provided in the video below.
</p>
<iframe width="500" height="205" src="https://www.youtube.com/embed/yofjFQddwHE" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div class="col-xs-5">
<iframe src="https://www.youtube.com/embed/7YgnJELpMyE?ecver=2" width="450" height="305" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
</div>
</div>
If you apply it and it doesn't work, it means different CSS rules are applied on those properties by stronger selectors in your project, leaving you two options:
- find and disable those rules (you can inspect element to find all rules currently applying to it)
- 在你的 CSS 中使用更强大(更具体)的选择器(你可以找到大量解释 CSS 特异性原则的在线资源 - 请记住,你的选择器越强大,你以后修改它的难度就越大。理想情况下,应该始终使用应用所需规则的最不具体的选择器,从而确保它们易于应用任何未来的模块)。
注意:很可能,iframe
选择器对于您的项目来说不够强大。您可以使用 a #id
, a.class
或者,如果您不想通过添加任何额外的类或 id 来更改标记,则可以使用否定来夸大其特异性:
iframe:not(#_):not(#_)` { /* css rules here */ }