ウィンドウscreen.height
例
画面の全高を取得します。
let height = screen.height;
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
height
プロパティは、ユーザーの画面の全高を返します。
height
プロパティは、高さをピクセル単位で返します。
プロパティはheight
読み取り専用です。
ノート
widthプロパティを使用して、ユーザーの画面の全幅を取得します。
構文
screen.height
戻り値
タイプ | 説明 |
数 | ユーザーの画面の全高(ピクセル単位)。 |
その他の例
すべての画面プロパティ:
let text = "Total width/height: " + screen.width + "*" + screen.height + "<br>" +
"Available width/height: " + screen.availWidth + "*" + screen.availHeight + "<br>" +
"Color depth: " + screen.colorDepth + "<br>" +
"Color resolution: " + screen.pixelDepth;
ブラウザのサポート
screen.height
すべてのブラウザでサポートされています:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |