Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 :target selector

CSS3 :target selector

Complete CSS SelectorComplete CSS Selector Reference Manual

Example

Highlight active HTML anchor:

:target

{

border: 2px solid #D4D4D4;

background-color: #e5eecc;

}

Try it »


Definition and Usage

# The name of an anchor is a URL that links to an element in 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 this property.

Selector
:target 4.0 9.0 3.5 3.2 9.6

Complete CSS SelectorComplete CSS Selector Reference Manual