开发者

Put the bar of the scroll bar on the bottom

I want a css attribute or sort of thing that puts the bar of a scroll bar on the bottom, euh, a div with fix height and width, shows a text, but the text is too big and wrapped into this div, so a scroll bar appears but the bar is in the t开发者_运维技巧op, I want it to appears on the bottom, did you understand me? if so, please just say how.

Regards.


If you can use Javascript, I found this handy little snippet: http://radio.javaranch.com/pascarello/2005/12/14/1134573598403.html So, you'd have a div object somewhere on your page and have it call your scroll to bottom function onload:

<html>
    <head>
        ...
        <script>
            function scroll_to_bottom(){
                var objDiv = document.getElementById("divExample");
                objDiv.scrollTop = objDiv.scrollHeight;
            }
        </script>
        ...
    </head>
    <body>
        ...
        <div id="divExample" onload="scroll_to_bottom();"></div>
        ...
    </body>
</html>

Now, I'm not sure if that is browser specific or not, but give it a shot and see what happens. Let me know if it works or if you have problems.

UPDATE: It looks like all browsers support scrollTop, and all but the earlier versions of IE support scrollHeight. http://www.quirksmode.org/dom/w3c_cssom.html#elementview

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜