:visited

  • Revision slug: CSS/:visited
  • Revision title: :visited
  • Revision id: 292406
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The :visited pseudo-class lets you select only links that have been visited. This style may be overridden by any other link-related pseudo-classes, that is {{ cssxref(":link") }}, {{ cssxref(":hover") }}, and {{ cssxref(":active") }}, appearing in subsequent rules. In order to style appropriately links, you need to put the :visited rule after the :link rule but before the other ones, defined in the LVHA-order: :link:visited:hover:active.

{{ gecko_callout_heading("2.0") }}

Starting in Firefox 4, major limitations to the styles you can apply using this selector have been introduced. For more information on the limitations and the motivation for them, see {{ Cssxref("Privacy and the :visited selector") }}. The same limitations have been adopted by other browsers, including Safari 5/4.1 and Chrome 6.

Examples

a:visited { color: #4b2f89; }
a:visited { background-color: white } 

Specifications

Specification Status Comment
{{ SpecName('CSS3 Selectors', '#link', ':visited') }} {{ Spec2('CSS3 Selectors') }}  
{{ SpecName('CSS2.1', 'selector.html#link-pseudo-classes', ':visited') }} {{ Spec2('CSS2.1') }}  

Browser compatibility

Browser Lowest Version
Internet Explorer 3.5
Firefox 1.0
Opera 3.5
Safari 1.0

See also

  • {{ Cssxref("Privacy and the :visited selector") }}
  • {{ Cssxref(":link") }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>:visited</code> <a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> lets you select only links that have been visited. This style may be overridden by any other link-related pseudo-classes, that is {{ cssxref(":link") }}, {{ cssxref(":hover") }}, and {{ cssxref(":active") }}, appearing in subsequent rules. In order to style appropriately links, you need to put the <code>:visited</code> rule after the <code>:link</code> rule but before the other ones, defined in the <em>LVHA-order</em>: <code>:link</code> — <code>:visited</code> — <code>:hover</code> — <code>:active</code>.</p>
<div class="geckoVersionNote">
  <p>{{ gecko_callout_heading("2.0") }}</p>
  <p>Starting in Firefox 4, major limitations to the styles you can apply using this selector have been introduced. For more information on the limitations and the motivation for them, see {{ Cssxref("Privacy and the :visited selector") }}. The same limitations have been adopted by other browsers, including Safari 5/4.1 and Chrome 6.</p>
</div>
<h2 class="editable" id="Examples">Examples</h2>
<pre>
a:visited { color: #4b2f89; }
a:visited { background-color:&nbsp;white } </pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr style="background-color: rgb(255, 204, 255);">
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Selectors', '#link', ':visited') }}</td>
      <td>{{ Spec2('CSS3 Selectors') }}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSS2.1', 'selector.html#link-pseudo-classes', ':visited') }}</td>
      <td>{{ Spec2('CSS2.1') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <th>Browser</th>
      <th>Lowest Version</th>
    </tr>
    <tr>
      <td>Internet Explorer</td>
      <td><strong>3.5</strong></td>
    </tr>
    <tr>
      <td>Firefox</td>
      <td><strong>1.0</strong></td>
    </tr>
    <tr>
      <td>Opera</td>
      <td><strong>3.5</strong></td>
    </tr>
    <tr>
      <td>Safari</td>
      <td><strong>1.0</strong></td>
    </tr>
  </tbody>
</table>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{ Cssxref("Privacy and the :visited selector") }}</li>
  <li>{{ Cssxref(":link") }}</li>
</ul>
Revert to this revision