Log in

View Full Version : Resolved Liquid Width + Absolutely Positioned Child



jlizarraga
08-27-2009, 08:45 PM
Hi all,

I cannot for the life of me figure this out. I have a container with a liquid width, fixed height, and 10px of padding.

Within this container, another DIV needs to be absolutely positioned near the bottom, and needs to be the same width that a normal DIV would be. In other words, I need this DIV to be 100% of the width of the container, minus 20px for the container's padding.

The problem is that setting a DIV's width to 100% does not take the parent element's padding into account (which is correct CSS behavior of course), and since the container is liquid I cannot use a fixed value.

Is there any solution to this problem?

Thanks!

Snookerman
08-27-2009, 09:23 PM
Change the width:100%; to left:10px; right:10px;

Good luck!

jlizarraga
08-27-2009, 11:19 PM
WIN.

Thanks!

Snookerman
08-28-2009, 06:17 AM
You're welcome, glad to help you.

Happy coding!