CSS - Link


CSS -  Link

  • In CSS, Links can be styled in many ways of CSS properties like color, font-family, background-color, font-size and text-alignment.

Sample Code :

<!DOCTYPE html>
<html>
<head>
    <style>

        /* unvisited link */
        a:link
        {
            color: red;
        }
    </style>
</head>
<body>
    <p>
        <b>
            <a
href="http://www.wikitechy.com/"target="_blank">
Welcome to Wikitechy website
            </a>
        </b>
    </p>
</body>
</html>

Code Explanation :


    Here this a: link Defines the style for normal unvisited links.

    Over here the href is the attribute specifying the destination address of the URL.( Here, we are directing  to www.wikitechy.com)  

    Here the target="_blank" specifies to Open up the  new tab.

OUTPUT :


    When we click the link it will change from blue to red which is displayed in the browser window as shown below.

 

     On clicking this link, it will redirect us to the www.wikitechy.com website as shown below.