HTML CSS examples for CSS Property:background-color
Set Background color property for div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .outer-container {<!-- ww w .j a v a2s. c o m--> width: 100%; } .outer-container .main-container { width: 980px; margin: 0 auto; height: 100px; } .blue .main-container { background: blue; } .green .main-container { background: green; } .red .main-container { background: red; } </style> </head> <body> <div class="outer-container blue"> <div class="main-container"></div> </div> <div class="outer-container green"> <div class="main-container"></div> </div> <div class="outer-container red"> <div class="main-container"></div> </div> </body> </html>