Web24 feb. 2015 · CSS has different pseudo selector by which you can achieve such effect. In your case you can use. :active : if you want background color only when the button is clicked and don't want to persist. :focus: if you want background color untill the focus is on the … Web24 sep. 2024 · Firstly, you have to change the default styles of the button:
Designing Button States – Cloud Four
element when you click on it: p:active, h1:active, a:active { background-color: yellow; } Try it Yourself » Example Select and style … clearance levels above top secret
Web17 okt. 2024 · const buttons = document.querySelectorAll('.button'); for(let i = 0; i < buttons.length; i++) { buttons[i].addEventListener('click', () => { buttons[i].classList.add('active'); }) } However, if you try this code (whether with the forEach or for loop), you'll notice a problem. If you click Button 1 it stays pressed. and tags to light blue. Then, we specified a rule using the :active selector that sets the text color of all active clearance level radioactive waste