CSS/Selectors/pseudo-classes/:target

From Web Education Community Group
< CSS‎ | Selectors
Revision as of 18:56, 21 November 2011 by Rworth (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Pseudo-classes :target

The :target pseudo-class represents an element that is the target element of the referring URI.

Syntax

:target{ properties }


Example

[style.css]

 a:link, a:visited{
   color: red;
 }
 :target::before{
   content: "Here. ";
 }


[index.html]

<body>
  <p><a href="#target1">Go to down!</a></p>
  <p id="target1">target1</p>
</body>

Css3 selectors target be.png

Css3 selectors target af.png

CSS defines the :target pseudo-class in 6.6.2. The target pseudo-class :target.