Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Getting a scrollbar to display only when necessary

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #24812
    daGUY
    Member

    I have a div with an exact height. Inside of this div will be text, but I don’t know how much (depends on the page). If there’s more text than can fit in the div, I want it to display a scrollbar, but I only want the scrollbar to display in that particular case. So if all the text fits within the div, I don’t want the scrollbar visible.

    Is this possible? I set a height on the div and used overflow: scroll, but this creates a persistent scrollbar that’s merely disabled when all the text fits. I just want it to display only when you need to scroll. Any ideas?

    #57278
    AshtonSanders
    Participant

    Yes it is possible. Use this instead:

    Code:
    overflow:auto;

    ;)
    Ashton Sanders

    #57281
    apostrophe
    Participant

    overflow: auto;

    EDIT.
    Too late again! :roll:

    #57283
    AshtonSanders
    Participant
    "apostrophe" wrote:
    Too late again! :roll:

    haha, we’re taking turns beating eachother to the bunch lol

    #57288
    daGUY
    Member

    Wow…shows you what happens when I haven’t had my morning coffee :D That’s like the most obvious thing ever. Sorry I even made a post about this :lol:

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.