Answers for "active color css"

6

css on click

<!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>
Posted by: Guest on October-25-2020
0

css :active

<!DOCTYPE html>
<html>
<head>
<style>
a:active {
  background-color: yellow;
}
</style>
</head>
<body>

<a href="https://www.w3schools.com">w3schools.com</a>
<a href="http://www.wikipedia.org">wikipedia.org</a>

<p><b>Note:</b> The :active selector styles the active link.</p>

</body>
</html>
Posted by: Guest on August-14-2021

Browse Popular Code Answers by Language