mozilla

Revision 289364 of :visited

  • Revision slug: CSS/:visited
  • Revision title: :visited
  • Revision id: 289364
  • 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

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: white } </pre>
<h2 class="editable" id="Specifications"><span>Specifications</span></h2>
<ul>
  <li><a class="external" href="http://www.w3.org/TR/CSS21/selector.html#link-pseudo-classes" rel="external nofollow" target="_blank" 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>
<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