# JavaScript Window Screen

« Previous
Next Chapter »

The window.screen object contains information about the user's screen.

## Window Screen

The window.screen object can be written without the window prefix.

Properties:

- screen.width
- screen.height
- screen.availWidth
- screen.availHeight
- screen.colorDepth
- screen.pixelDepth

## Window Screen Width

The screen.width property returns the width of the visitor's screen in pixels.

## Example

Display the width of the screen in pixels:

"Screen Width: " + screen.width

Result will be:

Try it Yourself »

## Window Screen Height

The screen.height property returns the height of the visitor's screen in pixels.

## Example

Display the height of the screen in pixels:

"Screen Height: " + screen.height

Result will be:

Try it Yourself »

## Window Screen Available Width

The screen.availWidth property returns the width of the visitor's screen, in pixels, minus interface features like the Windows Taskbar.

## Example

Display the available width of the screen in pixels:

"Available Screen Width: " + screen.availWidth

Result will be:

Try it Yourself »

## Window Screen Available Height

The screen.availHeight property returns the height of the visitor's screen, in pixels, minus interface features like the Windows Taskbar.

## Example

Display the available height of the screen in pixels:

"Available Screen Height: " + screen.availHeight

Result will be:

Try it Yourself »

## Window Screen Color Depth

The screen.colorDepth property returns the number of bits used to display one color.

All modern computers use 24 or 32 bits hardware to display 16,777,216 different colors ("True Colors").

Older computers used 16 bits, which gives a maximum of 65,536 different colors ("High Colors")

Very old computers, and old cell phones used 8 bits ("VGA colors").

## Example

Display the color depth of the screen in bits:

"Screen Color Depth: " + screen.colorDepth

Result will be:

Try it Yourself »

| Some computers report 32. Most computers report 24. Both display "True Colors" (16,777,216 different colors).

## Window Screen Pixel Depth

The screen.pixelDepth property returns the pixel depth of the screen.

## Example

Display the pixel depth of the screen in bits:

"Screen Pixel Depth: " + screen.pixelDepth

Result will be:

Try it Yourself »

| For modern computers, Color Depth and Pixel Depth are equal.

« Previous
Next Chapter »

### WEB HOSTING

UK Reseller Hosting

### WEB BUILDING

FREE Website BUILDER Free HTML5 Templates

### W3SCHOOLS EXAMS

HTML, CSS, JavaScript, PHP, jQuery, XML, and ASP Certifications

### SHARE THIS PAGE

### Color Picker

### HTML/CSS

HTML Tutorial HTML5 Tutorial CSS Tutorial CSS3 Tutorial Bootstrap Tutorial

### JavaScript

JavaScript Tutorial jQuery Tutorial jQuery Mobile Tutorial AngularJS Tutorial AJAX Tutorial JSON Tutorial

### Graphics

Canvas Tutorial SVG Tutorial Google Maps Tutorial

### Server Side

SQL Tutorial PHP Tutorial ASP Tutorial ASP.NET Tutorial VBScript Tutorial AppML Tutorial

### Web

Web Building Web Statistics Web Certification

### XML

XML Tutorial DTD Tutorial Schema Tutorial XML DOM Tutorial XPath Tutorial XSLT Tutorial XQuery Tutorial XSL-FO Tutorial RSS Tutorial WSDL Tutorial

### HTML/CSS

HTML Tag Reference HTML Event Reference HTML Color Reference CSS 1,2,3 Reference Bootstrap Reference

### JavaScript

JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference Google Maps Reference

### Server Side

PHP Reference SQL Reference ASP Reference VBScript Reference Razor Reference ASP.NET Reference

### XML

XML DOM Reference XSLT Reference XSL-FO Reference XPath Reference XQuery Reference Schema Reference RSS Reference SVG Reference

### HTML Charsets

HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 HTML Symbols HTML UTF-8

### HTML/CSS

HTML Examples CSS Examples

### Browser Scripting

JavaScript Examples HTML DOM Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples

### Server Scripting

PHP Examples ASP Examples VBScript Examples Razor Examples .NET Examples

### XML Languages

XML Examples DTD Examples XML DOM Examples XSL Examples XSLT Examples XPath Examples XQuery Examples Schema Examples RSS Examples SVG Examples