innerWidth property (window)
Returns the width of the browser's client area, including the vertical scrollbar, if rendered.
Note: The innerWidth property is supported in Internet Explorer from version 9.The innerWidth property is rarely useful, because scrollbars are not part of the document working area. Use the cross-browser clientWidth property of the html element instead. It returns the width of the browser's client area without the vertical scrollbar.
- You can get the height of the client area, including the vertical scrollbar with the innerHeight property.
- You can get the height of the client area, excluding the vertical scrollbar with the clientHeight property.
- The top-left corner of the client area relative to the top-left corner of the screen can be retrieved with the screenLeft and screenTop properties.
- If you need the total width of the browser window, use the outerWidth property.
- If you need information about the dimensions of the screen, use the screen object.
- To get the width of the document or an element in the document, please see the pages for the clientWidth, offsetWidth and scrollWidth properties.
You can find the related objects in the Supported by objects section below.
This property is read/write.
Integer that represents the width of the window client area, in pixels.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the innerWidth property:
Did you find this example helpful?
User Contributed Comments