Jump to content

Div background not changing


uaintgotthisid

Recommended Posts

I've got a webpage set up. I wanted it centred.I've used absolute positioning throughout, so I put a "holder" div around the rest.I added a left positioning to centre the whole lot.I now want to make the background a different colour but it doesn't change.I change the body background colour and it all changes. I simply want to make the margins around the edges different colours to make the centre stand out. I want the centre to remain white background for readability.Any ideas why the DIV doesn't change colour/color?

Link to comment
Share on other sites

A guess on my part:because to use position absolute the div's are removed from the flow of the document, so the containing div has no height. Link to the page would be nice.
http://uglyfashion.110mb.com/client/EuroUnion/ I have now set the height to Auto. It previously had no height. Auto did not work. Any chance you could expand on your comments to help me understand further what my issue is and avoid it in the future?I have since changed the height to a more exacting length and it solves the problem. If I wish for this to be a template, i.e. the height will change, is there a way of doing this?
Link to comment
Share on other sites

Well, what happens if the Content is reduced or expanded using your method? Add / subtract some text.Your layout can be done with floats, margins and padding. Google "3 column layout" and you should get a ton of replies.

Link to comment
Share on other sites

http://uglyfashion.110mb.com/client/EuroUnion/ I have now set the height to Auto. It previously had no height. Auto did not work. Any chance you could expand on your comments to help me understand further what my issue is and avoid it in the future?I have since changed the height to a more exacting length and it solves the problem. If I wish for this to be a template, i.e. the height will change, is there a way of doing this?
Anything that is "absolute" is not part of the flow of a page. By default, a container (like a div) will only be the size needed to show the things inside of that container and absolute things are not inside of it. You can manually set the size of a container, but that is the unchanging size it will be.Generally, it is bad to use absolute to build an entire or most of a web page. It has its use, but it is limited.
Link to comment
Share on other sites

...I've used absolute positioning throughout...
:) Why? There's no need to use absolute positioning to position your DIVs, especially if:
I wanted it centred.
Absolute positioning is very tricky... as you can see now, putting a simple color is an Indiana Jones trip to the Amazon jungles. I suggest you do it right and either remove your position:absolute; attributes or change them to relatives/floats, ESPECIALLY if you want to center your page.height:auto; doesn't work either, it's like not assigning a height at all... that's because it's already auto.Not all the way sure, try to use min-height and see if that works. Be aware though that IE6 has issues with min-height... there's a solution though: http://www.dustindiaz.com/min-height-fast-hack/
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...