i have a Div=MASTER with example 600px of width! i dont put the height beacuse i want that the Div=A and Div=B inside the Div=MASTER force the height of Div=MASTER.... but dont works! The Div=A and Div=B works the height but the Div=MASTER dont have any change in height!
Floated elements aren't calculated in the normal flow of the page and thus won't add any height to the container div. You should be using the body as the container anyways.
if you are working with floats it is best that you give a display:table to your containing div, yet like nick pointed out, if the main div is the one positioning elements on your page you should (could) swap it for styling the body in the css file
body { width:600px; margin:0 auto; /* for centering on the page*/ }
well iam dont use floats... maybe if put works, but i think that its a simple beginner fact of css, a div that respect the sizes.. of divs inside... i think that i need a simple value but i dont know what is...
as the people said above the only way you get that result is if you are using floats. the way to get around this is to use a footer or some element like and hr to clear the floats.
nice idea climaxdesigns, it does work, yet for my current experience using the display:table on the container and the display:block on the floats has worked just as fine, no extra elements required.
if nowhere_beginer isn't using floats he is probably using position:absolute. In this case I don't think a containing div can be stretched to fit the height. A code view rather than an image would be more helpful in determining (and fixing) your problem
It works just fine on IE and FireFox as well. I usualy go by heart with some issues, but sometimes when I like to make a statement I give a conclusive example.
My opinion is to trash the position:absolute It's cleaner and safer to use floats.
have a look at the example I previously posted and adapt it for your needs. It is quite easy to understand and it doesn't make use of position:absolute (which I presonally don't recommend)
To my knowledge you can't use that method and hope to have a content extend as its contents spawn.
ahem... I gave it heights only out of comodity. My mistake, I should have included content rather than give it a precise size for better illustration. have a look
ahaha tuche tsk. i dont eventhink you need display block in that exampleas the height will be determined by the content. ... ok i'm sold, new way of using floats ;)
I will say this thought, if you are using your divisions correctly, the use of the <hr /> makes for a nice phisycal break in the content if the user is looking at it text only or css off;)