html - IFrame 的默认宽度/高度

标签 html iframe specifications

是否有任何规范指定 IFrame 的默认宽度/高度?

我测试过的浏览器(FF、IE、Chrome)似乎使用 300x150px,但我找不到这方面的任何规范。我是否应该遇到这种情况,我可以依赖这些值还是应该始终明确设置宽度/高度?

最佳答案

我在 dev-tech-layout mailing list 上找到了答案-- 它是 CSS 规范的一部分。 默认比率2:1

300px默认宽度 定义在 CSS 规范的最后一段,the width of inline replaced elements 部分.

Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.

150 像素默认高度 定义在 CSS 规范的最后一段,关于 the height of inline replaced elements 的部分.

Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width.

关于html - IFrame 的默认宽度/高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5871668/

相关文章:

javascript - 如何避免没有 src 的 iframe 读取其父 HTML?

internet-explorer - SignalR - IE 中的 Forever Frame 在空闲几分钟后停止工作

java - Java System.getProperty() 方法识别的标准键的完整列表是什么?

javascript - 从用户输入的 javascript 表单中定位 iframe src

flash - HTML5 canvas 是否能够像 Flash 这样丰富复杂的游戏?

sql - 在哪里可以找到 SQL 语言规范

javascript - 将 onhover 更改为 onclick

css - 两个div重叠

javascript - 使脚本适用于两种输入,可能吗?

html - 如何为移动用户使用不同的字体系列?