Lecture

Window - window.screen

window.screen provides information about the visual setup of the user's screen.

It's mainly used when you want to know the size or resolution of the current screen or device being used.


Key Properties

  • screen.width: The full width of the screen (in pixels)

  • screen.height: The full height of the screen (in pixels)

  • screen.availWidth: The available width of the screen excluding the browser

  • screen.availHeight: The available height of the screen excluding the browser


Examples

Checking screen width and height

JavaScript
console.log(`The screen width is ${screen.width} pixels.`); console.log(`The screen height is ${screen.height} pixels.`);

Checking available screen size

JavaScript
console.log(`The available screen width is ${screen.availWidth} pixels.`); console.log(`The available screen height is ${screen.availHeight} pixels.`);
Mission
0 / 1

What cannot be determined using the window.screen object?

The total width of the screen

The total height of the screen

The version of the browser

The available width of the screen

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

HTML
CSS
JavaScript
Loading...