- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML onresize Event Attribute
The HTML onresize attribute is triggered when user resize the browser window.
Syntax
Following is the syntax −
<tagname onresize=”script”></tagname>
Let us see an example of HTML onresize event Attribute −
Example
<!DOCTYPE html> <html> <head> <style> body { color: #000; height: 100vh; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat; padding: 20px; } </style> </head> <body onresize="resizeFn()"> <h1>HTML onresize Event Attribute Demo</h1> <p>Now resize the browser window</p> <script> function resizeFn() { document.body.style.background = 'linear-gradient(45deg, #8BC6EC 0%, #9599E2 100%) no-repeat'; } </script> </body> </html>
Output
Now resize the browser window to observe how onresize event attribute works.
Advertisements