How to change button color on hover in JavaScript?

0 votes
38 views
Ravi Vishwakarma asked 13 days ago in Web Application by Ravi Vishwakarma

How to change button color on hover in JavaScript?

1 Answer

1 votes
Ethan Karla answered 10 days ago by Ethan Karla

We know that, in CSS psuedo selector is use to decorating the page elements.

    <!DOCTYPE html>
<html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta charset='utf-8' />
    <title></title>
    <style>
        * {
            text-align:center;
            margin:50px;
        }
        #btn {
            background-color:lightblue;
            width:30%;
            height:70px;
            border:1px solid white;
            border-radius:10px;
            color:white;
            transition:0.3s;
            font-size:15px;
        }
            #btn:hover {
                font-size:25px;
                background-color:orange;
                border:2px solid white;
            }
    </style>
</head>
<body>
    <button id='btn' >Hover Me</button>
</body>
</html>