<分区>
<分区>
<section>
<h3>About us</h3>
<p>British Airways virtual is one of the largest virtual airlines for Infinite Flight virtual airlines out there. With over 50 pilots, we have a bustling community. Make sure to come over and join us, and experience it for yourself!<br><br>
Check out the <a href="about.html">about page</a> for more info!</p><br>
<iframe width="80%;" height="500px;" src="https://www.youtube.com/embed/_g3UgCWAdGg" frameborder="0" allowfullscreen></iframe>
</section>
我有这个代码。有什么办法可以让 Youtube iframe 居中吗?我试过 CSS,但无法理解。
您可以在此处查看整个文件:https://github.com/GiacomoLaw/british-airways-virtual/blob/master/index.html
谢谢!
最佳答案
用 div 包裹 iframe 并给它一个 text-align:center;
例如 css 属性...
.divy {
text-align: center;
}
<section>
<h3>About us</h3>
<p>British Airways virtual is one of the largest virtual airlines for Infinite Flight virtual airlines out there. With over 50 pilots, we have a bustling community. Make sure to come over and join us, and experience it for yourself!<br><br>
<div class="divy">
Check out the <a href="about.html">about page</a> for more info!</p><br>
<iframe width="80%;" height="500px;" src="https://www.youtube.com/embed/_g3UgCWAdGg" frameborder="0" allowfullscreen></iframe>
</div>
</section>
关于html - 以 Youtube iframe 为中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40693152/
相关文章:
javascript - 未找到 HTML 文档的字符编码声明
javascript - Jquery Waypoints .sticky 方法
javascript - 如何使用服务器端 php (Laravel) 加载其他网站,例如 Hypothes.is 或 ProjectHuddle?
javascript - Google 版本 3 map 地理编码器,单击或拖动标记时获取标记图层的坐标
html - 像 my-2、my-lg-0、mr-sm-2 这样的 css 类在 bootstrap 4 中做什么?