CSS Links

DevJunctionPoint
0



links can be styled in many different ways

Styling Links

The four links states are:

  • a:link - a normal, unvisited link
  • a:visited - a link the user has visited
  • a:hover - a link when the user mouses over it
  • a:active - a link the moment it is clicked

When setting the style for several link states, there are some order rules:

  • a:hover MUST come after a:link and a:visited
  • a:active MUST come after a:hover
index.html
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS Links</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <h1>CSS Links</h1>
    <a href="https://devjunctionpoint.blogspot.com/">devjunctionpoint.com</a>
</body>

</html>

style.css
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

h1 {
    text-shadow: 2px 2px 4px red;
    margin-bottom: 30px;
}

a:link {
    color: red;
}

a:hover {
    color: yellow;
}

a:visited {
    color: brown;
}

a:active {
    color: blueviolet;
}


Tags

Post a Comment

0Comments

Do leave your comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!
To Top