Check out example codes for "css on click". It will help you in understanding the concepts better.

Code Example 1

CSS clicked event
:active {
  css declarations;
}

Code Example 2

a:active  {     background-color: yellow;  }

Code Example 3

<!DOCTYPE html>
<html>
<head>
  <style>
    /* On click: */
    a:active {
      background-color: yellow;
    }
    button:focus {
      background-color: yellow;
    }
    /* On hover: */
    h1:hover {
      background-color: red;
    }
    p:hover {
      background-color: red;
    }
  </style>
</head>
<body>
  <a href="#">Click Me</a>
  <button>Click me</button>
  
  <h1>Hover over me</h1>
  <p>Hover over me</p>
</body>
</html>

Code Example 4

something:active {}

Code Example 5

.x-btn:focus, .button:focus, [type="submit"]:focus {
   outline: none;
}

Code Example 6

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>

Learn ReactJs, React Native from akashmittal.com