CSS Links



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;
}


Related Posts:

  • CSS Linkslinks can be styled in many different waysStyling LinksThe four links states are:a:link - a normal, unvisited linka:visited - a link the user has visi… Read More
  • position Property The position property specifies the type of positioning method used for an elementThere are five different position values:staticrelativefixedab… Read More
  • Text PropertyCSS Text ColorThe color property is used to set the color of the text.The color is specified by:a color name - like "red"a HEX value - like "#ff0000"a… Read More
  • CSS Font CSS FontFont properties are used to add different styles to the fonts.Font properties are used to change the style, size, weight, etc. of the fo… Read More
  • CSS LIST There are two main types of listsunordered lists (<ul>) - the list items are marked with bulletsordered lists (<ol>) - the list item… Read More

0 Comments:

Post a Comment

Do leave your comments