0

I'd like to have a scrollbar at the bottom of the div but this CSS works only in Firefox, not Webkit browsers like Safari or Chrome.

div.hoge {
    width: 500px;
    overflow: auto;
}

I googled and found some pages mentioning you should use overflow-x or -webkit-overflow-scrolling but they didn't work either. Need to use some JSs? Any guesses?

1
  • Are you using Lion? Webkit browsers hide their scroll bars when not in use on osx 10.7.
    – Joe Flynn
    Commented May 2, 2012 at 4:41

4 Answers 4

1
  • If you need a scroll bar to appear always then, you can use overflow: scroll
  • If you need vertical scroller then, overflow-y: scroll
  • If you need only horizontal scroller then, overflow-x: scroll

As per the questions title: You can write mozilla specific styles like this

@-moz-document url-prefix() {

    div.hoge {
        width: 500px;
        overflow: auto;
    }

}
1

Here is an example fiddle of a div that scrolls on x. If you don't include the white-space: nowrap, then the text just wraps within the div and only the vertical (y-direction) scroll bar actually scrolls.

The fiddle shows two div elements; one with nowrap and one without. Also I put borders on the div to make it easier to see.

0

overflow: auto; doesn't make scrolling DIV, use overflow: scroll; if you want it on any particular axis, then use overflow-x: scroll; or overflow-y: scroll;

0

Have you tried overflow-x:scroll; ?

Also make sure that the div.hoge has the enough height to display the scroll bar at the bottom.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.