Changing css if content is scrollable

Discussion in 'Web Design and Development' started by tominated, May 20, 2007.

  1. tominated macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #1
    I have a problem with the template I am making ( http://tominatedsoftware.com/tigris/ ) where when the content is long enough to make it scroll, the scroll bars push some things out of alignment. Is there a way with javascript or something to see if a div's content is larger than the div and apply a css style to another element so it doesn't misalign when it needs a scrollbar. Hope you understand.... and reply.
    BTW: the scrollbar is put there by the "overflow: auto;" css property
     
  2. Mitthrawnuruodo Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #2
    You could always show the scrollbar... not an ideal solution, but since those scrollbars are one of (many) things different browsers implement differently, things will be pushed around in some of them when one is placed via auto.
     
  3. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #3
    That would also be my suggestion....certainly going to be easier than the alternatives.
     
  4. pengu macrumors 6502a

    Joined:
    Mar 20, 2005
    Location:
    Diddily Daddily...
    #4
    align the stuff from the LEFT of the scrollable area and allow about 25px free space. if there is no scrollbar, you will just see extra blue space on the right.
     
  5. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003
    #5
    You have more problems that just that.

    The amount of people on here who produce CSS layouts which are completely inflexible as soon as the text size changes is staggering.
     

    Attached Files:

  6. tominated thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #6
    @elppa: This layout isn't finished. I was going to work on the different text sizes after I do most of the main layout
     
  7. tominated thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #7
    Is there a way to always show the scrollbar, but only on Y? If i do "overflow: scroll;" it shows tho scrollbars for x and y
     
  8. Mitthrawnuruodo Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #8
    You could use the experimental and poorly supported:

    overflow-x: hidden;

    (x is the horizontal, right? I always forget... :eek:)
     

Share This Page