Window screen.width 属性
- 前のページ pixelDepth
- 次のページ availHeight
- 上一層に戻る Window Screen
定義と用法
width
属性はユーザーのスクリーンの全幅を返します。
width
属性はピクセルで計算された幅を返します。
width
属性は読み取り専用です。
ヒント:使用してください height 属性 ユーザーのスクリーンの全高を取得します。
例
例 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