moving companies : Computers : Programming : Languages : PHP : Not Quite PHP : HTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 22 people (82%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I stop text from wrapping in a browser?

Jul 7th, 1999 08:02
Erik Johansson, Nathan Wallace,


Try using the HTML <pre> tags.  Anything between them will be shown in
the browser with the exact formatting (including line breaks) that you
specify.
If you want something in the middle of a sentence to be nonwrappable 
then use &nsbp; instead of a space.
A Netscape/IE specific tag is <nobr>, this will let you make a whole 
sentence be nonwrappable, beware though this isn't in the HTML4 
standard (should work anyway). 
<?php
  echo "<pre>This won't wrap...</pre>";
  echo "This won't wrap
  echo "<nobr>This won't wrap</nobr>
?>