html - 完美的响应圈 iFrame

标签 html css iframe responsive-design geometry

如何创建一个完美的圆形且响应迅速的 iFrame? I know I can add rounded corners by surrounding the iframe with a div ,但我不确定如何制作一个完美的圆圈。

最佳答案

您需要用两个 div 包装您的 iframe。内层应该是position: absolute;,而外层应该是position: relative。您可以使用静态且相等的高度和宽度来使其成为完美的圆,as shown in this jsfiddle examples .

HTML

<div class="iframe-outer"><!--position: relative-->
    <div class="iframe-inner"><!--position: absolute-->
        <iframe src="www.google.com" width="600" height="450"></iframe>
    </div>
</div>

但是,因为我们生活在一个屏幕尺寸各不相同的世界中,并且因为您想要一个完美的圆,所以添加更多的 CSS 以使其具有响应性是很有用的,based on Nathan Ryan's answer to "Height Equal To Dynamic Width."

Here's a jsfiddle to demonstrate a complete solution.

关于html - 完美的响应圈 iFrame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26954636/

相关文章:

javascript - HTML/CSS : display circular divs in horizontal scrolling lineup? Div 出现在彼此之上?

html - 放置在 css 文件中时,转换/过渡效果不起作用

html - 为什么我的关键帧计时功能被忽略了?

javascript - 根据内容更改 iframe 高度

javascript - 按同一按钮触发 iframe 并提交表单

html - 是否可以通过浏览器开发工具查看浏览器正在使用哪个 srcset 图像

html - 影响文本的CSS不透明度过渡

css - 不让宽度假设为 100% 的方法?

jquery - 在桌面版本中,如何删除响应式导航栏上的超赞字体图标?

html - iframe内容无法响应移动设备上的媒体查询