Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any way to prevent a line break in HTML? For example, on one of my web pages the browser put a break after the comma in the number 43,560. I could remove the comma, but that makes the number harder to read.

I seem to remember old-style HTML has a way to prevent line breaks but it isn't universally supported and isn't legal in stricter varieties like XHTML.

share|improve this question

closed as off topic by joe, jtimberman, ChrisF, Jeff Atwood Nov 20 '09 at 18:02

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
belongs to stack overflow ! –  joe Nov 20 '09 at 16:22
1  
or belongs in doctype –  ricbax Nov 20 '09 at 16:44
    
The tag you were looking for was the <NOBR> tag, but you should use Johannes's answer below. –  Travis Nov 20 '09 at 17:25
    
doctype.com –  Kevin Panko Nov 20 '09 at 17:26

1 Answer 1

up vote 14 down vote accepted

You can use styles to ensure that the browser won't break lines there. CSS has a white-space property which does that. So

<span style="white-space: nowrap;">43,560</span>

should work.

If you need this more often, you should probably create a CSS class for that, though.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.