Adding values to specific elements using CSS - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:attribute equals value

Description

Adding values to specific elements using CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style>
input[type=text] {
   background:red;
}

input[type=text]:enabled {
   background:lightgreen;
}

input[type=text]:disabled {
   background:lightgray;
}
</style> <!--from  ww  w.ja  va 2 s  .  c om-->
 </head> 
 <body> 
  <form action="">
    First name: 
   <input type="text" value="Mickey"> 
   <br> Last name: 
   <input type="text" value="Mouse"> 
   <br> Country: 
   <input type="text" disabled value="Disneyland"> 
  </form>  
 </body>
</html>

Related Tutorials