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:
- In the above code, we have created <a> tag in the HTML body section.
- By default, the anchor text color is set to blue, and text-decoration is set to be underlined.
- 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“
- See the above output, the default decoration is changed to none.