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>
    /* On click: */
    a:active {
      background-color: yellow;
    button:focus {
      background-color: yellow;
    /* On hover: */
    h1:hover {
      background-color: red;
    p:hover {
      background-color: red;
  <a href="#">Click Me</a>
  <button>Click me</button>
  <h1>Hover over me</h1>
  <p>Hover over me</p>

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>

function myFunction() {
    document.getElementById("demo").style.color = "red";

Learn ReactJs, React Native from