:target
Applies one or more styles to the target element of of the referring Uniform Resource Identifier (URI).
Syntax
:target {
sRules
}
Possible values
sRules
Value that specifies one or more Cascading Style Sheets (CSS) attribute/value pairs.
Remarks
The :target pseudo-class selects the target element of the referring URI. A fragment identifier is used to identify a location within a page, 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
Standards Information
This pseudo-element is defined in CSS Selectors Level 3
.
Applies to
a, abbr, acronym, address, b, big, blockquote, body, caption, center, cite, code, col, colgroup, dd, dfn, dir, div, dl, dt, em, form, hn, html, i, img, input, input type=button, input type=checkbox, input type=file, input type=hidden, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, kbd, label, legend, li, listing, marquee, menu, ol, p, plaintext, pre, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp