CSS

CSS – Links

CSS – Links

Links can be styled in numerous ways in CSS. Links are styled differently based on the state the links are in. Those states are:

  • a:link
  • a:visited 
  • a:hover 
  • a:active 
Syntax:
<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        /* unvisited link */
a:link {
  color: red;
}

/* visited link */
a:visited {
  color: green;
}

/* mouse over link */
a:hover {
  color: hotpink;
}

/* selected link */
a:active {
  color: blue;
}

    </style>
</head>
<body>
    <div>
        <a href="https://www.greatlearning.in" target="_blank">Great Learning</a>
    </div>
</body>
</html>
Output:





Top course recommendations for you

    Circular Queue
    1 hrs
    Beginner
    3.1K+ Learners
    4.5  (213)
    Python Stack
    2 hrs
    Beginner
    5.9K+ Learners
    4.46  (308)
    AI and Big Data in IOT
    1 hrs
    Intermediate
    10.2K+ Learners
    4.48  (1167)
    Selenium Basics
    1 hrs
    Beginner
    25.5K+ Learners
    4.43  (1941)
    Selenium with Python
    1 hrs
    Beginner
    13.2K+ Learners
    4.45  (836)
    Selenium Projects with Python
    2 hrs
    Intermediate
    8.9K+ Learners
    4.5  (245)
    Java Projects
    1 hrs
    Beginner
    25.3K+ Learners
    4.19  (244)
    JDBC in Java
    1 hrs
    Beginner
    9.4K+ Learners
    4.41  (872)
    Flask Python
    1 hrs
    Beginner
    8.3K+ Learners
    4.38  (463)
    Linked List in Python
    3 hrs
    Beginner
    2.9K+ Learners
    4.55  (62)