Change the color of selected item using :focus - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Color

Description

Change the color of selected item using :focus

Demo Code

ResultView the demo in separate window

<!doctype html>

<html lang="en">
 <head> 
  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]--> <!--  w w  w.  j a  v a  2 s .c  o  m-->
  <style>

li:focus{
   color:red;
   outline:none;
}

      </style> 
 </head> 
 <body> 
  <ul> 
   <li tabindex="0">item1</li> 
   <li tabindex="0">item2</li> 
   <li tabindex="0">item3</li> 
  </ul>  
 </body>
</html>

Related Tutorials