Search w3schools.com:

SHARE THIS PAGE

CSS Reference

CSS Reference CSS Selectors CSS Reference Aural CSS Web Safe Fonts CSS Units CSS Colors CSS Color Values CSS Color Names CSS Color HEX CSS3 Browser Support

CSS Properties

CSS3 :target Selector

Complete CSS Selector Reference Complete CSS Selector Reference

Example

Highlight active HTML anchor:

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

Try it yourself »

Definition and Usage

URLs with an # followed by an anchor name, link to a certain element within a document. The element being linked to is the target element.

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The :target selector is supported in all major browsers.

Note: The :target selector is not supported in Internet Explorer 8, and earlier versions.


Complete CSS Selector Reference Complete CSS Selector Reference


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]