如何水平放置iframe? [英] How to center an iframe horizontally?
本文介绍了如何水平放置iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请考虑以下示例:(现场演示)
HTML:
<div>div</div>
<iframe></iframe>
CSS:
div, iframe {
width: 100px;
height: 50px;
margin: 0 auto;
background-color: #777;
}
结果:
为什么 iframe
不像 div
中心对齐?
Why the iframe
is not centrally aligned like the div
? How could I centrally align it?
推荐答案
添加 display:block;
到您的iframe css。
Add display:block;
to your iframe css.
这篇关于如何水平放置iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文