Difference between CSS overflow : auto and overflow : scroll

If you want to make a DIV element with scrolling either horizontal or vertical, you set CSS’s overflow attribute to scroll or auto. But there is a small but important difference between these scroll & auto.

See the below style setting for making a DIV scroll-able :

<div style="width:100px;height:100px;overflow:scroll;">

Note that this will set scroll bars permanently. But if you want to show scroll bars only when the content's height /width is more than the specified one of DIV, then use "overflow:auto" as -

<div style="width:100px;height:100px;overflow:auto;">

 

Happy Coding!!!