Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html: "-" is same as space" "?

Tags:

html

In html, if I create a html table with column like this

<table>
    <tr>
        <td>This is your ID</td>
        <td>021-000-00001</td>
        <td>...</td>
    </tr>
</table>

space and - will cause multiple lines when it is rendered. So for space, the solution is:

<td>This&nbsp;is&nbsp;your&nbsp;ID</td>

but for dash sign -, even I replace it as —, like

<td>021&mdash;000&mdash;00001</td>

it still displays as multiple line.

How to resolve it?

like image 760
KentZhou Avatar asked Aug 29 '26 01:08

KentZhou


1 Answers

Try something like

<td style="white-space: nowrap;">021-000-00001</td>

that should stop it breaking at the hyphens.

like image 141
Nick Avatar answered Aug 30 '26 16:08

Nick