Grow your CSS skills. Land your dream job.

Simple liquid width problem. Is this even possible?

  • # August 27, 2009 at 4:50 pm

    Head up liquid layout gurus! I have a very simple problem that I can’t find a solution to:

    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?

    # August 27, 2009 at 7:20 pm

    Got the answer from another forum. Instead of using a 100% width, you just set the left and right values to the padding value. :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".