HTML onresize Event Attribute

Description

The event attribute onresize occurs when the browser window is resized.

Syntax

<element onresize="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE HTML>
<html>
<body onresize="myFunction()">

<p>Try resizing your browser window.</p>

<script>
function myFunction() {
    alert("You have resized the browser window.");
}
</script>

</body>
</html>

Supported Tags

<body>

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
YesYes45Yes32Yes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
4545Yes32YesYes