Using the :target Selector
Description
The :target selector matches the element that the URL fragment identifier refers to.
Example
The following code shows the :target selector in action.
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
:target {<!--from ww w . j a v a2 s .c om-->
border: thin black solid;
padding: 4px;
color: red;
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the website</a>
<p id="mytarget">
I like <span>HTML</span> and CSS.
</p>
<a id="w3clink" href="http://w3c.org">Visit the W3C website</a>
</body>
</html>