How to change CSS of active hyperlink, paragraph and heading?
Question: How to change CSS of active hyperlink, paragraph and heading?
Answer: We can use Pseudo Class of CSS :active Selector
1 2 3 |
a:active { background-color: yellow; } |
Full code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<html> <head> <style> p:active, h1:active, a:active{ background-color: red; } </style> </head> <body> <h1>Welcome to T4Tutorials.com</h1> <div class="intro"> <h2 id="firstname">My name
is shamil</h2> <p id="hometown">I am a programmar</p> </div> <h2>Welcome to tutorial:</h2> <a href="https://www.t4tutorials.com">T4Tutorials.com</a> <a href="http://www.google.com" target="_blank">Google.com</a> </body> </html> |
Output
Welcome to T4Tutorials.com
My name is shamil
I am a programmar