CSS help please

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

CSS help please

Post by Live24x7 »

Amongst other I have two blocks :

[text]body {background:#red;}
#container {background:#fff; width:1100px;}[/text]

The problem is #container background fails to turn #fff and inherits #red from the body element.

Any explanations why this is happening ?

Please help - i have wasted one hour on this trivial issue and fail to understand why this is happening :(
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: CSS help please

Post by social_experiment »

What does the html look like and does it occur in all browsers?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: CSS help please

Post by Live24x7 »

thanks for replying - yes it occurs in all browsers
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: CSS help please

Post by Live24x7 »

And here is the html structure
<html><head>
</head>
<body>
<div id="container">
<div id="content">
<div id="post">
</div><!--eof post-->
<div id="sidebar"> </div><!--eof sidebar-->
</div><!--eof content-->
</div><!--eof container-->

</body></html>

User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: CSS help please

Post by social_experiment »

Code: Select all

body {background-color : red;}
#container {background-color :#fff; width:1100px;}
I added -color behind background declaration and removed the # in front of red. For color keywords such as red, cyan, magenta, etc you can leave the hash away.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: CSS help please

Post by Live24x7 »

thanks buddy -

but that still does not solve the problem for me.
Did you check this at your end ?
and the red thing here is just for the example the actual color is #252525 - not that it should matter anyways.
The body background-color still overpowers the #container background-color.

:(
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: CSS help please

Post by Live24x7 »

tomorrow i have client to answer and this would me the most ridiculous thing i would have ever said - that i cannot change the background color and the container color- yike :(
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: CSS help please

Post by social_experiment »

Live24x7 wrote:Did you check this at your end ?
Yip :)

Code: Select all

<html><head>
<style >
body {background-color : red;}
#container {background-color :#fff; width:1100px;}
</style>
</head>
<body>
<div id="container">
 Blob.
<div id="content">
<div id="post">
</div><!--eof post-->
<div id="sidebar"> </div><!--eof sidebar-->
</div><!--eof content-->
</div><!--eof container-->

</body></html>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply