Posts Tagged ‘HTML’

Create a div with a scrollbar

Monday, September 8th, 2008

Frames are better to be avoided, but what would you do if you want to display a long list of information on a short space? with CSS you can have a scroll bar inside a div without creating an inner frame.

The syntax is very simple:

<div style=”overflow-y:scroll;height:50px;width:200px”>
  a<br>
  b<br>
  c<br>
  d<br>
  e<br>
  f<br>
  g<br>
</div>

It will appear as follows:

a

b

c

d

e

f

g