how to position vertical scroll bar in html?

陌路散爱 提交于 2019-12-10 21:16:02

问题


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)


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/4152230/how-to-position-vertical-scroll-bar-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!