Results 1 to 4 of 4

Thread: Liquid Width + Absolutely Positioned Child

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default Liquid Width + Absolutely Positioned Child

    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!
    Last edited by Snookerman; 08-28-2009 at 06:18 AM.
    My site: FreshCut :)

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Change the width:100%; to left:10px; right:10px;

    Good luck!

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    jlizarraga (08-27-2009)

  4. #3
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    WIN.

    Thanks!
    My site: FreshCut :)

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    You're welcome, glad to help you.

    Happy coding!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •