What is the difference between a:default to a:link?

Is it true to say the a:link is a “private case” of a:default?

Are there any special criterion to differ between them?

Hi,
I would rather call it a state or mode of the anchor. The anchor “default” state applied/colored by the browser could be as “link” if it is expected to be one.

The difference is the “a” targets all anchors regardless their states, while the “a:link” specifies it to be unvisited.

The general anchor selector:
a /* targets all anchor elements with or w/o states */

Anchor pseudo classes e.g.:
a:link /* targets the anchor’s unvisited state /
a:visited /
targets the anchor’s visited state /
a:focus /
targets the anchor has focus state /
a:hover /
targets the anchor’s on hover state /
a:active /
targets the anchor’s is active (during mouse down) state, only used by MS IE */

Note: Mouse down (or tab key) gives the link focus. Mouse up (or enter) fires off the link.
Tip: Declare the different states in a logical order: (L)ove (F)oils (H)(A)te. The class-less anchor selector will be overruled if it then gets a state.

I am confused, a:default (a colon default) isn’t an existing a: pesudo calss? If it’s not, then I guess we can’t even talk about such a concept === a:default…

I thought you were exploring a CSS level 4 construct that is under consideration…

https://drafts.csswg.org/selectors-4/#default-pseudo

11.1.4. The Default-option Pseudo-class: :default
The :default pseudo-class applies to the one or more UI elements
that are the default among a set of similar elements. Typically applies to
context menu items, buttons and select lists/menus.
One example is the default submit button among a set of buttons.
Another example is the default option from a popup menu.
In a select-many group (such as for pizza toppings), multiple elements can match :default.
For example, [HTML5] defines that :default matches the “default button” in a form,
the initially-selected (s) in a

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.