HTML iFrame - 标记或 CSS 中的大小?

标签 html css iframe markup

那么这有什么区别吗:

<iframe src="iframe.html" width="100" height="100"></iframe>

还有这个:

<iframe src="iframe.html" style="width: 100px; height: 100px;"></iframe>

两者都在 HTML5 中受支持,我想知道哪一个更好/推荐?有什么建议吗?

最佳答案

在那种情况下,我建议使用内联,比如

<iframe src="iframe.html" width="100" height="100"></iframe>

因为如果 css 没有正确加载或被用户禁用,容器大小将是相同的。 并且有利于避免跳 block 效应。

关于HTML iFrame - 标记或 CSS 中的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22823739/

相关文章:

javascript - 单击其元素时,我的汉堡菜单消失了

查询 :Automatically change the width equal to an element

javascript - 在文档之间移动整个 html 页面上下文

javascript - 如何执行 "inline solution"&lt;input type ="text"> 只允许数字,否则它也会发出警报?

Javascript:如何加入所有链接(数组)

javascript - 更改 anchor 链接文本大小和颜色

html - 带有 css 固定位置 : possible? 的 iframe

javascript - 使用前预加载图像

html - 将搜索栏放在导航栏中

javascript - 从 asp.net 中的 iFrame 获取值