【发布时间】:2016-01-08 15:24:02
【问题描述】:
我有一小部分 html 代码,并且喜欢 iframe 只有一半大小,但位于页面中心:
这里是页面:https://www.outdoorequipped.com/active/contacts
<div class="row">
<div class="map-container">
<iframe src="https://www.google.com/maps/embed?pb=!1m0!3m2!1sen!2s!4v1451982933747!6m8!1m7!1sIT5z6S82FJMAAAQZdjRuFQ!2m2!1d34.238620415813!2d-77.94889641093141!3f55.18!4f0!5f0.7820865974627469" height="250" width="600"></iframe>
</div>
</div>
还有她我的css:
.map-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: hidden;
}
/* 16x9 Aspect Ratio */
.map-container-16x9 {
padding-bottom: 56.25%;
}
/* 4x3 Aspect Ratio */
.map-container-4x3 {
padding-bottom: 75%;
}
.map-container iframe {
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
}
知道如何正确地做吗?
【问题讨论】:
-
你是指水平居中还是垂直居中?
标签: css iframe responsive-design center