HTML: How to create a DIV with only vertical scroll-bars for long paragraphs?

Awan picture Awan · Apr 2, 2010 · Viewed 460.9k times · Source

I want to show terms and condition note on my website. I dont want to use text field and also dont want to use my whole page. I just want to display my text in selected area and want to use only vertical scroll-bar to go down and read all text.

Currently I am using this code:

<div style="width:10;height:10;overflow:scroll" >
 text text text text text text text text text
 text text text text text text text text text
 text text text text text text text text text
 text text text text text text text text text
 text text text text text text text text text
 text text text text text text text text text
 text text text text text text text text text
 text text text text text text text text text
</div>

Two Problems:

  1. It is not fixing the width and height and spread until the all text appears.
  2. Second it is showing horizontal scroll-bar and I don't want to show it.

Answer

janmoesen picture janmoesen · Apr 2, 2010

Use overflow-y. This property is CSS 3.