:target pseudo-class

Applies one or more styles to the target element of the referring Uniform Resource Identifier (URI).

Selectors Level 3, Section 6.6.2Internet Explorer 9

 

Syntax

selector:target {...}

Parameters

selector

A CSS simple selector.

Standards information

Remarks

The :target pseudo-class selects the target element of the referring URI. A fragment identifier is used to identify a location within a document, and is formed using a number sign followed by an anchor identifier—for example, http://www.example.com/mypage.html#section_3.

Examples

The following selects the div element of class important that is the target element of the referring URI. If the document's URI has no fragment identifier, there is no target element.


div.important:target

 

 

Show:
© 2014 Microsoft