+ 3

How to change button selector background that the default is blue

6th Jan 2018, 8:33 AM
Fahri Z. Lasuru
4 Antworten
+ 5
button { background-color: blue; }
6th Jan 2018, 8:49 AM
Calviղ
Calviղ - avatar
0
I want, when it is off (non-active) the bg is default and when it is on clicked or dragged the bg is changed
6th Jan 2018, 11:38 PM
Fahri Z. Lasuru
0
maybe button:hover{ background-color: blue; }
7th Jan 2018, 1:24 AM
skate1062
skate1062 - avatar
0
html: <button id="blueBtn" onclick="addClass()">Submit</button> <script> function addClass() { const btn = document.getElementById('blueBtn'); btn.classList.add(bgBlue); } </script> css: .bgBlue { background-color: blue; }
12th Jan 2018, 11:11 AM
Vladislav Pomazan
Vladislav Pomazan - avatar