• Post category:CSS

CSS :link() Pseudo Class Selector | Advanced Guide

CSS Link Selector

In this article, we will see the syntax of CSS link selector and how to use it.

The syntax for link selector

selector:link
{
declaration list;
}

It selects any HTML element targeted by the selector if its status is un-visited (or default).

Ex:
It selects any anchor element, if its status is un-visited then apply none text-decoration

a: link
{
text-decoration:none;
}

Example Code:
CSS:

a:link{
text-decoration: none;
}

HTML:

<a href="#">Click Here</a>

Output:

 

Steps:

  1. In the above code, we have created <a> tag in the HTML body section.
  2. By default, the anchor text color is set to blue, and text-decoration is set to be underlined.
  3. I want the to text-decoration be set to none for the anchor tag. So, in CSS We select “a:link” and in the parentheses, we use the “text-decoration” property and give the value as “none
  4. See the above output, the default decoration is changed to none.

Leave a Reply