Set Scroll Position to Bottom Of Element


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.

Who is Participating?
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,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.