Are There Other Whitespace Codes Like &Nbsp for Half-Spaces, Em-Spaces, En-Spaces etc Useful in HTML

Are there other whitespace codes like   for half-spaces, em-spaces, en-spaces etc useful in HTML?

Yes, many.

Including, but not limited to:

  • [ ] hair space :  or
  • [ ] 6-per-em space : (no character reference available)
  • [ ] narrow no-break space : (no character reference available)
  • [ ] thin space :  or
  • [ ] 4-per-em space : or
  • [ ] non breaking space :   or  
  • [ ] punctuation space :  or
  • [ ] 3-per-em space : or
  • [ ] en space : or
  • [ ] figure space : or
  • [ ] em space : or

span{background-color: red;}
<table>
<tr><td>non breaking space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>narrow no-break space:</td><td> <span> </span></td></tr>
<tr><td>en space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>3-per-em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>4-per-em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>6-per-em space:</td><td> <span> </span></td></tr>
<tr><td>figure space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>punctuation space:</td><td> <span> </span> or <span> </td></tr>
<tr><td>thin space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>hair space:</td><td> <span> </span> or <span> </span></td></tr>
</table>

Smaller space than  

I agree with the other answerers, you are definitely using the wrong tool. If you are a beginner and CSS is over your head, use a table, it's really simple:

<table>
<tr> <td>Email</td> <td>whatever</td> </tr>
<tr> <td>Tel.</td> <td>012345</td> </tr>
</table>

However for anybody who is really in need of unusual spaces, Wikipedia has an overwhelming selection. Notably there is thin space (, breaking) and Narrow No-Break Space (#x202F;, non-breaking).

Tab space instead of multiple non-breaking spaces ( nbsp )?

It's much cleaner to use CSS. Try padding-left:5em or margin-left:5em as appropriate instead.

HTML equivalent to   ...that DOES break;

If you want a wider-than-normal space that doesn't prevent line breaks, you probably want either an en space (U+2002, ) or an em space (U+2003, ). Typically, an en space is twice as wide as a normal space, and an em space is four times as wide.

HTML - Add certain spaces. so each row is equal vertically

HTML Sample Image 5

https://www.w3schools.com/css/tryit.asp?filename=trycss_table_align

Try with table & text-alight



Related Topics



Leave a reply



Submit