Open In App
Related Articles

HTML | onresize Event Attribute

Improve Article
Improve
Save Article
Save
Like Article
Like

The onresize event attribute is triggered each time when resize the browser window size.
Supported Tags: 

Syntax: 
 

<element onresize = "script">

Attribute Value: This attribute contains single value script which works when onresize event call.
Note: This attribute works with body tag.
Example: 
 

html




<!DOCTYPE html >
<html>
    <head>
        <title>onresize event attribute</title>
        <style>
            body {
                text-align:center;
            }
            h1 {
                color:green;
            }
        </style>
        <script>
            function Geeks() {
                alert("Window Size Changed") ;
            }
        </script >
    </head>
    <body onresize = "Geeks()">
        <h1>GeeksforGeeks</h1>
        <h2>onresize event attribute</h2>
    </body>
</html>                                   


Output: 
 

onresize

Supported Browser: The browser supported by onresize event attribute are listed below: 
 

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 4
  • Opera 7
  • Firefox 1
  • Safari 1.1

 

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 16 Aug, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials