HTML onresize Event Attribute HTML Reference


Execute a JavaScript when the browser window is resized:

<body onresize="showMsg()">

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Note: The onresize event attribute is supported in all major browsers.

1. Definition and Usage

The onresize attribute fires when an object is resized.

The onresize attribute is most often used when the browser window is resized.

2. Differences Between HTML 4.01 and HTML5


3. Syntax

<element onresize="script">

4. Attribute Values

Value Description
script The script to be run on onresize

Relative articles