html - 居中 iframe 谷歌地图

标签 html css

我想让 iframe 居中,但它不会移动。如何让它发挥作用?

<section>
<iframe src="insertlocation" width="600" height="450" frameborder="0" style="border:0" align="center"
allowfullscreen></iframe>
</section>

最佳答案

通过将此样式放在父 div 上,您可以将 iframe 居中放置在另一个容器中。

<section id="parentContainerExample" style="display: flex; align-items: center; justify-content: center;">

<iframe: width="600" height="450"></iframe>

</section>

编辑:这是一个工作 fiddle https://jsfiddle.net/ywp9veug/

关于html - 居中 iframe 谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38986711/

相关文章:

javascript - 如何使同位素画廊拉伸(stretch)周围的容器?

javascript - 在单独的框中显示 html 表格内容

javascript - 显示AJAX请求的结果

javascript - CSS 在 JS 库添加的元素上保持原始样式

html - 翻转网格标题的问题以及触摸设备时的操作

jquery - 表单输入中的掩码数字仅显示两位小数但保存原始值

javascript - 函数内的单个函数不会触发,而其他函数会触发

jquery - 将绝对元素水平放置在视口(viewport)内

visual-studio-2010 - Resharper 8 和供应商前缀?

php - UL 列表样式不适用于 woocommerce 结帐页面