< Back to CSS pseudo class :target

Use css :target pseudo class to change background color of selected section - online html sandbox


Code
Rendered HTML (iframe)

Few points related to Implementation

  1. The code is executed in an iframe. Hence there is no mix up with current page css or javascript.
  2. The execution is achieved by posting the code to server and setting the form target to the iframe id.

Related

  1. CSS properties
  2. CSS selectors
  3. CSS tutorials and cookbooks
  4. HTML tags