mozilla

Revision 60985 of :link

  • Revision slug: CSS/:link
  • Revision title: :link
  • Revision id: 60985
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 2 words added, 1 words removed

Revision Content

{{ CSSRef() }}

Summary

The :link CSS pseudo-class lets you select links inside elements. This will select any link, even those already styled using selector with other link-related pseudo-classes like {{ cssxref(":hover") }}, {{ cssxref(":active") }} or {{ cssxref(":visited") }}. In order to style only non-visited links, you need to put the :link rule before the other ones, as defined by the LVHA-order: :link:visited:hover:active.

Examples

a:link {color:slaygrate;}
.external:link {background-color:lightblue;}

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1 {{ CompatGeckoDesktop("1") }} 3.0 3.5 1.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 1.5 {{ CompatGeckoMobile("1.9.2") }} {{ CompatUnknown() }} {{ CompatUnknown() }} 3.2

Revision Source

<p>{{ CSSRef() }}</p>
<h3 id="Summary">Summary</h3>
<p>The <code>:link</code> CSS <a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> lets you select links inside elements. This will select any link, even those already styled using selector with other link-related pseudo-classes like {{ cssxref(":hover") }}, {{ cssxref(":active") }} or {{ cssxref(":visited") }}. In order to style only <em>non-visited</em> links, you need to put the <code>:link</code> rule before the other ones, as defined by the <em>LVHA-order</em>: <code>:link</code> — <code>:visited</code> — <code>:hover</code> — <code>:active</code>.</p><h3 id="Examples">Examples</h3>
<pre>a:link {color:slaygrate;}
.external:link {background-color:lightblue;}</pre>
<h3 class="editable" id="Specifications"><span>Specifications</span></h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/CSS21/selector.html#link-pseudo-classes" title="http://www.w3.org/TR/CSS21/selector.html#link-pseudo-classes">CSS 2.1 Selectors #link</a></li> <li><a class="external" href="http://www.w3.org/TR/css3-selectors/#link" rel="external nofollow" target="_blank" title="http://www.w3.org/TR/css3-selectors/#link">CSS 3 Selectors #links</a></li>
</ul>
<h3 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>1</td> <td>{{ CompatGeckoDesktop("1") }}</td> <td>3.0</td> <td>3.5</td> <td>1.0</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>1.5</td> <td>{{ CompatGeckoMobile("1.9.2") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>3.2</td> </tr> </tbody> </table>
</div>
Revert to this revision