CSS Pseudo-class :target
This selector selects an element, which fits to the fragment identifier of the URI which had been used to access the page. http://www.example.com/#text
can be selected by :target
. #text
is the ID of the element, so the browser will open the page in a position where the element with the ID #text
is at the top of the page. If you can see the full page in the browser without scrolling, then the page will be opened in the "normal" position.
If the element is a p
it can be selected with p:target
.
Examples
Compatibility
Chrome | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|
All | 1.3+ | 9+ | 9.5+ | 1.3+ |