Nadjib Mami
Nadjib Mami

Reputation: 5830

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 top, I want it to appears on the bottom, did you understand me? if so, please just say how.

Regards.

Upvotes: 1

Views: 2658

Answers (1)

Bryce Siedschlaw
Bryce Siedschlaw

Reputation: 4226

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

Upvotes: 4

Related Questions