css on click

    a:active
 {   
 background-color: yellow;
 }.x-btn:focus, .button:focus, [type="submit"]:focus {
   outline: none;
}:active {
  css declarations;
}
P Example
Click on a <p> element to change its text color to red:

 <p id="demo" onclick="myFunction()">Click me to change my text color.</p>

 
<script>
function myFunction() {
    document.getElementById("demo").style.color = "red";
}
</script>