Showing a scrollbar only in Firefox
Question by Kei Izumi
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?
Answer by Starx
- 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;
}
}