|
TexasWebDevelopers -> RE: No background in IE header (6/11/2009 19:14:50)
|
It's the cascades that mess me up. Generally I'll set the body background first: body { background: #FFF;} Then give the body the wrapper class <body class="wrapper"> and then set the container div background: .wrapper #container {background: #FFF; } Then for each div nested inside the container I still use background like: .wrapper #header {background: #FFF; } .wrapper #mainContent {background: #FFF; } .wrapper #footer {background: #FFF; } Then, out of habit, I use the element level assignment for different background colors and color: .wrapper #footer { background: #FFF; background-color:#DDD; color:#000; } It's redundant but you'll get warnings if you don't set the colors on the elements inside the divs: .wrapper #footer P { background: #FFF; background-color:#DDD; color:#000; } The cascade is what seems to be important to the validators. A color, set far down the cascade, can overwrite the more general settings--as it should be. But you'll catch a warning if you set a general setting and not affirm it further down the cascade. So you'll see verbose warnings in the validators like "You have no background-color set (or background-color is set to transparent) but you have set a color. Make sure that cascading of colors keeps the text reasonably legible." or "Same colors for color and background-color in two contexts .style1 and .style2". With the large number of browsers to contend with, I tend to be really verbose in my CSS sheets. The overhead (bytes) is really not that much what with high speed connections nowadays. If I am in error here, tailslide, please correct me. I'm a .NET programmer first and a CSS guy second.
|
|
|
|