Window screen.width 屬性
- 上一頁 pixelDepth
- 下一頁 availHeight
- 返回上一層 Window Screen
實例
例子 1
獲取屏幕的總寬度:
let width = screen.width;
例子 2
所有屏幕屬性:
let text = "總寬度/高度:" + screen.width + "*" + screen.height + "<br>" + "可用寬度/高度:" + screen.availWidth + "*" + screen.availHeight + "<br>" + "顏色深度:" + screen.colorDepth + "<br>" + "顏色分辨率:" + screen.pixelDepth;
語法
screen.width
返回值
類型 | 描述 |
---|---|
數字 | 用戶屏幕的總寬度(以像素為單位)。 |
瀏覽器支持
所有瀏覽器都支持 screen.width
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
- 上一頁 pixelDepth
- 下一頁 availHeight
- 返回上一層 Window Screen