Window innerWidth 属性
描述
innerWidth 属性返回窗口内容区域的宽度。
innerWidth 属性为只读属性。
语法
window.innerWidthor just:
innerWidth
返回值
| 类型 | 描述 |
| 一个数字 | 浏览器窗口内容区域的内部宽度,以像素为单位。 |
更多示例
所有高度和宽度属性:
let text =
"<p>innerWidth: " + window.innerWidth + "</p>" +
"<p>innerHeight: " + window.innerHeight + "</p>" +
"<p>outerWidth: " + window.outerWidth + "</p>" +
"<p>outerHeight: " + window.outerHeight + "</p>";亲自试一试 »浏览器支持
window.innerWidth 所有浏览器均支持:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | 9-11 |
