• 0

CSS: DIV Scrollbars


Question

I have a div thats about 200px wide and I want it to have horizontal scrollbars if the text needs more space than 200px. Below is the css properties that I am using, but it shows vertical scrollbar.

DIV.scroll{

height: 20px;

width: 200px;

overflow: auto;

border: 1px solid #666;

background-color: #ccc;

}

How can I have it show horizontal scrollbar rather than vertical?

Thanks

Amrinder

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

The only time I've gotten this to happen is when I am styling 'pre' tags or elements with white-space set to 'pre'. Otherwise the text will wrap down for horiztonal I believe. PRE makes the text appear exactly how it is in the source. It's useful for display code that you want people to see the formatting of. Maybe try setting the whitespace to pre?

Link to comment
Share on other sites

  • 0
The only time I've gotten this to happen is when I am styling 'pre' tags or elements with white-space set to 'pre'.  Otherwise the text will wrap down for horiztonal I believe.  PRE makes the text appear exactly how it is in the source.  It's useful for display code that you want people to see the formatting of.  Maybe try setting the whitespace to pre?

586221370[/snapback]

Thanks for the info. I will keep this in mind the next time I need to do this. This time however, I placed the text inside a table and specided the width of the table to be longer than the outside div. That forced it show horizontal scrollbars rather than vertical.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.