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:

  • Introduction to CSSWhat is CSS?CSS is a language that we use to style an HTML document.It describes how elements will be displayed.CSS stands for Cascading Style Sheets.… Read More
  • CSS BordersBorder property helps in creating borders around the textCSS border properties allow you to specify the style, width, and color of an element's border… Read More
  • CSS ColorCSS ColorsColor property is used to set the color of the text.Syntax: {color: value;}Now there are many ways of giving this value to the colour. Some … Read More
  • CSS BackgroundsCSS BackgroundsCSS background properties are used to add background effects for elementsWe will learn below following CSS background properties:backgr… Read More
  • CSS Margin CSS MarginsMargins are used to create space around elements, outside of any defined bordersWith CSS, you have full control over the margins. The… Read More

0 Comments:

Post a Comment

Do leave your comments