Change Background of selected element - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Change Background of selected element

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

textarea:focus, :focus, select:focus { background-color: yellow; }


      </style> 
 </head> <!--from w w w  .ja v a2  s  . c  om-->
 <body> 
  <div class="textarea1"> 
   <textarea rows="1" cols="20">
  </textarea> 
  </div> 
  <div class="dropdown"> 
   <select> <option value="volvo">Volvo</option> 
   <option value="saab">Saab</option> <option value="opel">Opel</option> 
   <option value="audi">Audi</option> </select> 
  </div> 
  <div class="textarea2"> 
   <textarea rows="1" cols="20">
  </textarea> 
  </div>  
 </body>
</html>

Related Tutorials