Set Scroll Position to Bottom Of Element

Posted on 2006-03-27
Last Modified: 2012-05-05

I have a <span> element with height, width and overflow attributes set. As i press a button javascript adds to the text written inside, eventually overflowing the element and causing scroll bars to appear. Is there a way to automatically locate the user at the bottom of the element, meaning they don't need to scroll down themselves.

Question by:shaggy_the_sheep
    1 Comment
    LVL 17

    Accepted Solution

    Hey Richard,

    You can't do this in CSS, you'll be needing to use javascript to provide that functionallity for you.

    check out scrollTop and scrollLeft, if I remember correctly these have setters too, that in combination with innerHeight or some other property like it should get you what you want.

    Good luck,


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
    In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now