rahim asgari
rahim asgari

Reputation: 12437

how to position vertical scroll bar in html?

I have a div with fixed width and height and overflow:scroll attribute.

I would like the vertical scroll bar appears in the left side of the div instead of right.

Any css or javascript solution? (supporting both ff and ie)

Upvotes: 3

Views: 10071

Answers (3)

Spudley
Spudley

Reputation: 168665

Not possible in standard HTML/CSS. If you really need to do this, you'll have to do some javascripting.

But my question would be why would you want to do this? You'll be altering the standard user interface. Unless you've got a fairly specific use-case for it where it makes sense, it'll be a lot of work for virtually no gain, and your users are unlikely to thank you for it.

Upvotes: 2

Dyppl
Dyppl

Reputation: 12381

You can put your div in anouther div and set outer div's direction to rtl, like that:

<div style="direction: rtl; overflow: scroll">
     <div style="direction: ltr">
         Long content
     </div>
</div>

But this, unfortunately, doesn't work in FireFox (works in Opera and IE). So maybe some custom scrollbar solution is a way to go if you really need to do it.

Upvotes: 2

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

You can use JScrollPane, a cross-browser jQuery plugin, to create a custom scrollpane with your own scrollbar.

I know you didn't ask for a jQuery solution, but I think it's the obvious choice in this case

Upvotes: 5

Related Questions