stellaartois
asked on
DIV Background colour not showing
Hello,
Please visit the following url:
http://www.makeaquiz.net/test/new.php
On this page there is a div named 'content'. It is centered using margin: 0 auto and it is also inside a floating 'wrapper' div.
I want the 'content' div to have a background colour of #FBFBFB, which is set in the CSS, but for some reason I can only get the background to show if it is set to FLOAT: left.
The hosted page has the 'content' div set to FLOAT: left, so that you can easily inspect the element and see the background disappearing when the float is taken away.
Please can you help me to get the background colour to show when it is centered, I've been racking my brain for a while now and can't see where I'm going wrong.
Thank you for any assistance,
Luke
Please visit the following url:
http://www.makeaquiz.net/test/new.php
On this page there is a div named 'content'. It is centered using margin: 0 auto and it is also inside a floating 'wrapper' div.
I want the 'content' div to have a background colour of #FBFBFB, which is set in the CSS, but for some reason I can only get the background to show if it is set to FLOAT: left.
The hosted page has the 'content' div set to FLOAT: left, so that you can easily inspect the element and see the background disappearing when the float is taken away.
Please can you help me to get the background colour to show when it is centered, I've been racking my brain for a while now and can't see where I'm going wrong.
Thank you for any assistance,
Luke
also the lighter grey shade is visbile..
ASKER
Hi qwerty,
Thank you for your prompt response.
The colour only shows when the DIV is floated to the left.
I have now removed the float from the element and you can now see that the colour has disappeared.
Thanks for any more assistance,
Luke
Thank you for your prompt response.
The colour only shows when the DIV is floated to the left.
I have now removed the float from the element and you can now see that the colour has disappeared.
Thanks for any more assistance,
Luke
You dont have height defined when Your element is not floated.
You could add something like this to #content div:
min-height: 800px;
height:auto !important;
height: 800px;
Regards
You could add something like this to #content div:
min-height: 800px;
height:auto !important;
height: 800px;
Regards
give some height to content div and it'll work,...
ASKER
Hello,
Thank you for the information, it works when I add a height, however the AUTO height doesn't work.
Because the page is not going to be a fixed height, how do I make it so that it expands to the contents?
What is the best way to do it?
Thank you,
Luke
Thank you for the information, it works when I add a height, however the AUTO height doesn't work.
Because the page is not going to be a fixed height, how do I make it so that it expands to the contents?
What is the best way to do it?
Thank you,
Luke
As I wrote, give it min-height. My solution is cross browser compatible.
Regards
Regards
ASKER
Hi R-Byter,
Thank you again, I can apply a min height, but the DIV is not expanding to the content for some reason
Thanks,
Luke
Thank you again, I can apply a min height, but the DIV is not expanding to the content for some reason
Thanks,
Luke
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
But since this color is very very light..u cannot make out
for example, if u give it red color.. u'll see it is showing
try this and u'll get to know what i'm saying
#content {
background-color:#FF0000;;
float:left;
margin:0 auto;
text-align:left;
width:770px;
}