Example

Styling Links (Hyperlinks)

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link name="favicon" type="image/x-icon" href="https://skillzam.com/uploads/system/e353194f3b7cd1b75d69c3ab88041985.png" rel="shortcut icon" />
    <title> Styling Links (Hyperlinks)</title>
    
    <style>

        a, span {
            font-size: 1.2em;
        }

        /* unvisited link */
        a:link {
            color: red;
        }

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

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

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

        /* Link Decoration */
        .linkDecor:link {
            text-decoration: none;
        }

        .linkDecor:visited {
            text-decoration: none;
        }

        .linkDecor:hover {
            text-decoration: underline;
        }

        .linkDecor:active {
            text-decoration: underline;
        }

    </style>

</head>
<body>
<!--
    links : can be styled with any CSS property (e.g. color, font-family, background, etc.).
    links can be styled differently depending on what state they are in.
    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
    text-decoration : property is mostly used to remove underlines from links
-->

    <h1>Demo: Styling Links (Hyperlinks)</h1>

    <h2>CSS Link Color -  </h2>
    <span>Skillzam link : <a class="linkColor" href="https://skillzam.com" target="_blank">Click here</a></span>

    <h2>CSS Link Decoration -  </h2>
    <span>Workzam link : <a class="linkDecor" href="https://workzam.com" target="_blank">Click here</a></span>

</body>
</html>

Output

View original