How To Prevent Automatic HTML Line Breaks

Recently, I had a list of command-line options in a table, and my browser was automatically inserting a line-break in-between the hyphen and the option character.
1 2 3 |
<td> <code class="option">--help, -h</code> </td> |
To prevent this, I simply added a little CSS:
1 2 3 4 5 6 |
<style> code.option { white-space: nowrap; } </style> |
NOTE: Never use the
1 |
<nobr></nobr> |
HTML directive – it is obsolete!
Leave Your Comment
All fields marked with "*" are required.