Switch to full style
HTML code examples
Post a reply

inherit background color from the parent element

Sat Dec 03, 2011 11:52 pm

Code:
<html>
<
head>
<
style type='text/css'>

#mainbar
{
  
background:#BBCC33;

}
#section
{
  
color:#fff;
  
background:#435234;
  
clear:both;
  
padding:0;
  
text-align:center;
  
font-size:1em;
  
height:2em;
  
line-height:2em;

 
}

a.testlink
{
  
background:inherit;
  
color:#FFFFFF;
  
text-decoration:none;
}

#section a:hover
{
  
text-decoration:underline;
}

 
</
style>
<
title>inherit background color from the parent element</title>
</
head>
<
body>
  <
div id="mainbar">
   <
div id="section">
 

     
test <a href="#" class="testlink" >link</a
      
   </
div>
    
test <a href="#" class="testlink" >link</a
   </
div>


</
body>
</
html>

 




Post a reply
  Related Posts  to : inherit background color from the parent element
 gradient background color using CSS     -  
 skymiles background color     -  
 change background color with RGB     -  
 Background color - mile200     -  
 Follow window background color     -  
 changing the background color for site main menu.     -  
 get parent class name     -  
 advantage of the event delegation model over event-inherit     -  
 Usage of big element tag.     -  
 Pop the element off the end of array     -  

Topic Tags

CSS Background