Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create small SPACES in HTML?

There is em dash and en dash. Is there an "en" equivalent to   ? Is there an en equivalent to pure Ascii 32?

I want a better way to write this:

123<span class="spanen">&nbsp;</span>456<span class="spanen">&nbsp;</span>789 

or this:

123<span class="spanen"> </span>456<span class="spanen"> </span>789 
like image 654
user89021 Avatar asked Apr 27 '10 11:04

user89021


People also ask

How do I make 10 spaces in HTML?

To create extra spaces before, after, or in-between your text, use the &nbsp; (non-breaking space) extended HTML character.

How do you add 20 spaces in HTML?

Type &nbsp; where you want to insert an extra space. Add one non-breaking space character for every space you want to add. Unlike pressing the spacebar multiple times in your HTML code, typing &nbsp; more than once creates as many spaces as there are instances of &nbsp; .

How do I put spaces in one line in HTML?

character. The &nbsp; character creates a space that does not break into a new line. Two words that are separated by a non-breaking space always appear on the same line. The &#9; and &Tab; characters create tab spaces in HTML.


2 Answers

&thinsp; (thin space) should do

Note that &nbsp; has not the same with as an &mdash; (—); to separate numbers you should use a narrow no-break space (U+202F).

As others have mentioned, you are better off using the CSS property word-spacing to define the width of your spaces. it's probably a good idea to combine it with white-space:nowrap;

like image 155
knittl Avatar answered Sep 18 '22 22:09

knittl


Don't use hacks that make no sense. If you wish to separate some words, I suggest you use the CSS property word-spacing:

.strangeNumbers {    word-spacing: 0.5em;  }
<span class="strangeNumbers">123 456</span>
like image 21
ANeves Avatar answered Sep 20 '22 22:09

ANeves