:link
Quick Summary for :link
The :link CSS pseudo-class represents an element that has not yet been visited. It matches every unvisited <a> or <area> element that has an href attribute.
Code Usage for :link
/* Selects any <a> that has not been visited yet */ a:link {   color: red; } 
More Details for :link

:link

The :link CSS pseudo-class represents an element that has not yet been visited. It matches every unvisited <a> or <area> element that has an href attribute.

/* Selects any <a> that has not been visited yet */ a:link {   color: red; } 

Styles defined by the :link pseudo-class will be overridden by any subsequent link-related pseudo-class (:active, :hover, or :visited) that has at least equal specificity. To style links appropriately, put the :link rule before all other link-related rules, as defined by the LVHA-order: :link:visited:hover:active.

Note: Use :any-link to select an element independent of whether it has been visited or not.

Syntax

:link

Examples

By default, most browsers apply a special color value to visited links. Thus, the links in this example will probably have special font colors only before you visit them. (After that, you'll need to clear your browser history to see them again.) However, the background-color values are likely to remain, as most browsers do not set that property on visited links by default.

HTML

<a href="#ordinary-target">This is an ordinary link.</a><br> <a href="">You've already visited this link.</a><br> <a>Placeholder link (won't get styled)</a> 

CSS

a:link {   background-color: gold;   color: green; } 

Result

Specifications

Specification
HTML Standard # selector-link
Selectors Level 4 # link

See also

Link-related pseudo-classes: :visited, :hover, :active

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)DeutschEspañolFrançais日本語한국어PolskiPortuguês (do Brasil)Русский中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
For a long time it had seemed to me that life was about to begin - real life. But there was always some obstacle in the way, something to be gotten through first, some unfinished business, time still to be served, or a debt to be paid. Then life would begin. At last it dawned on me that these obstacles were my life.
Alfred D. Souza
Random CSS Property

scroll-padding-block-start

The scroll-padding-block-start property defines offsets for the start edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
scroll-padding-block-start css reference