Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

div scrolling text does not work

Status
Not open for further replies.

Pinpoint

Programmer
Dec 23, 2001
49
GB
Hi,

I'm trying to set up a simple text box, which will auto-include scroll bars to allow text larger than the box to be displayed. My test code is

<div id=&quot;priceswindow&quot; style=&quot;position: absolute; width: 200; height: 300;

overflow: hidden; border-width: 2px; border-style: solid; border-color: brown;&quot;>

Div area text running on over several lines we hope in order to test the overflow properties.

</div>

However, the text box as displayed simply stretches to include all the text on 1 line, ignoring the height/width attributes. Is there something wrong with this code ? I have tried most variations of the style options, and checked other examples and see no obvious differences. I am running Win XP and IE6 incase there's a problem.

Thanks,

Pinpoint
 
Did you try just using <textarea> specifying rows and columns?
 
Are you talking about an actual <textarea> or just the text in the div? If you're talking about the div as you posted above, it worked for me. The size was right and the text wrapped, but wasn't hidden because there was enough room. I changed the height to 60px and it did indeed hide the some of the text.

If you're wanting to add scrollbars, you'd have overflow: scroll instead. Try this out with the example you posted but change, say, the height to 60px.

Kevin
A+, Network+, MCP
 
Pinpoint,

[tt]<TEXTAREA>[/tt] can be used, however:

In you code just change [tt]overflow:hidden[/tt] to [tt]overflow:scroll[/tt] then it works. At least in my IE5.

Good Luck §;O)


Jakob
 
Pinpoint, the browsers are becoming more and more specific by day. I would suggest changing your height and width properties to include the units you are using:

width: 200px; height: 300px;

Also, like dkdude suggested, overflow: hidden; will make your contents hidden when they outgrow the box. Using the suggested overflow: scroll; will make them available all the time and overflow: auto; when they are needed.

Hope it helps.
 
Thanks all.

Adding the px to the height and width properties has done the trick.

Pinpoint.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top