Skip to content
Related Articles

Related Articles

Improve Article

HTML | onwheel Event Attribute

  • Difficulty Level : Basic
  • Last Updated : 03 Dec, 2018

This attribute works when the wheel of pointer device is rolled up or down over an element. The onwheel attribute also works when the user scrolls or zooms on an element by using mouse or touchpad.


<element onwheel = "script">

Attribute Value: This attribute contains single value script and it works when onwheel attribute called. It is supported by all HTML elements.

Note: This attribute is new in HTML 5.


<!DOCTYPE html>
        <title>onwheel event attribute</title>
            #geeks {
                border: 1px solid black;
            h1 {
        <h2>onwheel event attribute</h2>
        <div id = "geeks" onwheel="Function()">GeeksforGeeks: 
        A computer science portal for geeks</div>
            function Function() {
                document.getElementById("geeks").style.fontSize = "30px";
                document.getElementById("geeks").style.color = "green";



Supported Browsers: The browser supported by onwheel event attribute are listed below:

  • Chrome 31.0
  • Internet Explorer 9.0
  • Firefox 17.0
  • Safari: Not supported
  • Opera 18.0

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :