Screen widthProperty

Screen 对象参考手册Screen Object

Definition and Usage

The width property declares the width of the screen that displays the browser, in pixels.

Syntax

screen.width


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the width property.


Example

Example

Return the total width of your screen:

<script>

document.write("Total width: " + screen.width);

</script>

The output of the above example is:


Try it Yourself »


实例s

More Examples

This example includes all screen properties.


Screen 对象参考手册Screen Object Other Extensions