Grow your CSS skills. Land your dream job.

Overflow – dynamic declaring possible?

  • # June 5, 2009 at 9:13 pm

    I really have no idea what to call my question but here is exactly what I am wanting to do.

    I have my own forum running on phpbb3 and I have set rules for signatures for users like your signature can’t be over 500 pixels in height. Now I know there will always be someone who either doesn’t read the rules or simply doesn’t care so I was wondering if there was a way to dynamically declare an overflow css depending on the size of the signature of a user.

    Example:
    User A:
    signature contains a single image that is only 300 x 100…so I would want the size of the signature box to fit the image.

    User B:
    signature contains two images each 400 x 300 totaling the signature size to be 400 x 600…here I want the overflow to be declared so it creates scrollable signature for that user.

    So basically I want the overflow to only activate if a user has 500px worth of content, text or images, but if they dont to just display the content normally.

    What I tried:

    Code:
    width:100%;
    height:500px;
    overflow:auto;

    This works essentially but the problem is that it resizes the signature field on EVERYONE’s signature including User A who wasn’t using 500px to suddenly be 500px regardless the content.



    Hopefully I was clear enough…can anyone help me out with this?

    # June 6, 2009 at 7:20 pm
    "RottNKorpse" wrote:
    I have set rules for signatures for users like your signature can’t be over 500 pixels in height.

    Haha you must really be fond of scrolling. lol

    "RottNKorpse" wrote:
    Hopefully I was clear enough…can anyone help me out with this?

    Yea, your (theoretical) solution lies in "max-height."

    Code:
    max-height: 500px

    It’s the theoretical solution because it doesn’t work in IE6…

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".