Treehouse: Grow your CSS skills. Land your dream job.

div height:100% of div height:auto?

  • # November 26, 2010 at 2:08 am

    Anybody ever figure this out?

    For instance:




    Obviously that isn’t going to work but how do you MAKE it work? :P

    In other words(image), how do you achieve THIS:
    click me!!!11

    # November 26, 2010 at 4:49 am

    If you actually want the wrapping div to be visible – say like you have a background you need to display – then you can do it like this:




    If you are talking about making the div 100% to the inside of actual wrapping div and that wrapping div being dynamic – you’re best doing that with a little Javascript : )

    # November 26, 2010 at 5:24 am

    Last time i tried with Javascript, the only idea I got was to find the height of the div but since it’s auto I always got undefined back. Is this the case?

    EDIT: Ummm nevermind, I’m stupid..

    # November 26, 2010 at 5:31 am

    $(".article_img").load(function () {
    var aheight = $("#a").css("height");

    Works great. :)

    # November 26, 2010 at 6:09 am

    If you can use JavaScript, that’s great. Otherwise there are lots of fancy CSS solutions. Try googling up “Equal Height Columns”

    # November 28, 2010 at 4:26 am

    thanks chris

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

You must be logged in to reply to this topic.