css on click
snippet in html

css clicked event

user2827

CSS clicked event
:active {
  css declarations;
}

css on click

user2759

<!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>

on click css

user7062


:active {
  css declarations;
}

html button remove border on click

user3384

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

css on click

user6232

something:active {}

css on click

user5286

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>