是否有任何规范指定 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/