I am having some serious issues understanding the whole "position:" attribute and how and when to use it when positioning div layers. I am attempting a 100% CSS website and I just can't seem to get my divs positioned correctly ...
I took a look at this thread for some advice and changed a few of my divs to p's, but I still can't get it to do what I want.
Basically, I have a "main" div with auto height so that it stretches with the content inside. Inside that "main" div, I have other divs to hold the content, and no matter what I do, I can't get them to have auto height on their own - I have to give them a specific pixel height.
I have "main" containing "mcm_main", and I want "mcm_main" to have auto-height to hold everything inside of it, whilst positioning the p's inside "mcm_main" where I want them inside of the containing div. I've tried experimenting with the z-index but I still can't get them all correct ... I'm probably using that wrong, too.
Here's my code:
And here is the page code:Code:html, body { background-color:#cacac8; margin: 0px; padding: 0px; height: 100%; font-family: "Verdana", Tahoma, sans-serif; font-size: 100%; color: #003050; } .main { z-index: 1; height: auto; width: 950px; padding: 10px; margin-top: -25px; margin-bottom: 15px; } .mcm_main { background-color: #faf9f5; height: auto; width: 850px; padding: 10px; margin-top: 20px; font-size: 0.75em; text-align: justify; position: relative; z-index: 1; } .mcm_dm { position: absolute; background: #FF0; width: 265px; left: 113px; text-align: center; z-index: 1; } .mcm_email { position: absolute; background: #FF0; width: 265px; right: 113px; text-align: center; z-index: 1; } .mcm_print { position: absolute; background: #FF0; width: 265px; top: 375px; left: 25px; text-align: center; z-index: 1; } .mcm_web { position: absolute; background: #FF0; width: 265px; top: 375px; left: 303px; text-align: center; z-index: 1; } .mcm_tv { position: absolute; background: #FF0; width: 265px; top: 375px; right: 25px; text-align: center; z-index: 1; }
I may be over-complicating this as I'm known to do, but any help would be greatly appreciated ... I've attached a jpg to show what I'm trying to do positioning-wise so it's more understandable. I just want them to automatically make the containing div "mcm_main" as tall as the content.Code:<div class="main"> <div class="mcm_main"> <p class="mcm_dm"> <img src="images/mcm_dm_1.png"> </p> <p class="mcm_email"> <img src="images/mcm_email_1.png"> </p> <p class="mcm_print"> <img src="images/mcm_print_1.png"> </p> <p class="mcm_web"> <img src="images/mcm_web_1.png"> </p> <p class="mcm_tv"> <img src="images/mcm_tv_1.png"> </p> </div> </div>![]()
Thanks for any help in advance!



Reply With Quote



Bookmarks