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!

Prevent text from wrapping 1

Status
Not open for further replies.

Billkamm

Programmer
Feb 9, 2006
74
US
I have some text that I do not wish to wrap to a second a line. I tried placing this in a DIV tag and setting a width and overflow:auto, however, this will cause a scroll when the width of the DIV is greater than its container (the browser window).

If I only have 3 characters I do not want a scrollbar. I only want a scrollbar when the text is long enough to exceed the width of the DIV.

Basically I'm trying to make it so the text never wraps. Assume this simple page:

Code:
<body>
I do not want this sentence to ever wrap to the second line, but only want scrollbars if the browser window clips the text
</body>

The page will be almost as simple as that above and I basically want to make sure that the sentence never wraps (no matter what length as this sentence is dynamically generate and will be of a variable length). I only want a scrollbar if the browser window clips the text. Any help is appreciated. Thank you.
 
I never knew that property existed. Thanks for the tip.
 
Unfortunately, I have some grid data I'm displaying in a table and despite the "nowrap" being set on every table cell, it is still wrapping the table columns on me :(

Any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top