...

View Full Version : Resolved background color



harkly
11-15-2010, 07:00 PM
I am trying to get my background color to be solid. However this won't work with any of the DOCTYPES out there.

Does anyone know a work around??



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>
<style type="text/css">


#wrapperMsg {
text-align: left;
margin: 0px 0px 0px 50px;
padding: 0px;
border:0;
width: 800px;
background: #333333;

}


#side-a {
float: left;
width: 100px;

}


#content {
float: left;
width: 105px;
}

#side-b {
float: right;
width: 500px;
}


</style>
</head>

<body>


<div id='wrapperMsg'>
<div id='side-a'>Image</div>
<div id='content'>Name <br> Date </div>
<div id='side-b'>Title <br> Message</div>
</div>

</body></html>

DrDOS
11-15-2010, 07:08 PM
body {background: #333333;margin: 0 auto}
will center the page with a dark gray background and no white surround.

SB65
11-15-2010, 07:08 PM
It's because all the content of #wrapperMsg is floated, hence it has no height and the background colour doesn't show. If you clear the floats at the end of #wrapperMsg by adding overflow:auto to its css, then the div will extend to include the floated content and hence your background will show up.

harkly
11-15-2010, 07:16 PM
It's because all the content of #wrapperMsg is floated, hence it has no height and the background colour doesn't show. If you clear the floats at the end of #wrapperMsg by adding overflow:auto to its css, then the div will extend to include the floated content and hence your background will show up.



This did it Thanks!

DrDOS
11-15-2010, 07:17 PM
SB65's is the one you want for just the div having a background, mine gives it to the whole page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum