CSS Property Value How to - CSS3 target pseudo-class








Question

We would like to know how to cSS3 target pseudo-class.

Answer


<!DOCTYPE html>
<html>
<head>
<!--   w w w . java 2  s  . co  m-->
<style type='text/css'>
p:target {
  background: #fc0;
}
</style>
</head>
<body>
  <a href="#demo">Click me to Highlight</a>
  <p id="demo">Highlight this text with that link up there.</p>
</body>
</html>

The code above is rendered as follows: