IFrame 的默认宽度/高度 [英] Default width/height of an IFrame

查看:51
本文介绍了IFrame 的默认宽度/高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is there any spec specifying the default width/height of an IFrame?

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

Browsers I tested (FF, IE, Chrome) seem to use 300x150px but I couldn't find any spec on this. Should I ever come in the situation, can I rely on these values or should I always set width/height explicitly?

推荐答案

我在 dev-tech-layout 邮件列表 -- 它是 CSS 规范的一部分.默认比例2:1.

I found the answer on the dev-tech-layout mailing list -- it's part of the CSS spec. The default ratio is 2:1.

300px默认宽度在 CSS 规范的最后一段中定义,内联替换元素的宽度.

The default width of 300px is defined in the last paragraph of the CSS spec, section on the width of inline replaced elements.

否则,如果 'width' 的计算值为 'auto',但没有满足上述条件,则宽度"的使用值变为300 像素.如果 300px 太宽而不适合设备,UA 应该使用比例为 2:1 的最大矩形的宽度代替设备.

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.

150px默认高度在 CSS 规范的最后一段中定义,内联替换元素的高度.

The default height of 150px is defined in the last paragraph of the CSS spec, section on the height of inline replaced elements.

否则,如果 'height' 的计算值为 'auto',但没有满足上述条件,则必须设置'height'的使用值到比例为 2:1 的最大矩形的高度,有一个高度不大于 150px,宽度不大于设备宽度.

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.

这篇关于IFrame 的默认宽度/高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆