CSS3 :targetSelectors

Complete CSS Selector Reference Manual

Example

Highlight active HTML anchor:

:target
{
border: 2px solid #D4D4D4;
background-color: #e5eecc;
}

Try it Yourself »

Definition and Usage

An anchor name is a URL that links to an element within a file. The element is linked to the target element.

The :target selector can be used to style the currently active target element.


Browser Support

The numbers in the table indicate the first browser version that supports the property.

Selectors
:target 4.0 9.0 3.5 3.2 9.6

Complete CSS Selector Reference Manual

other extensions