Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put spaces between text in html?

Tags:

html

css

How do you to put spaces between text in html? For example,

<p>a b       c</p>

What do you put to have space between b and c?

like image 783
weather api Avatar asked Feb 26 '17 02:02

weather api


2 Answers

Try using white-space with value pre.

pre Sequences of whitespace are preserved. Lines are only broken at newline characters in the source and at <br> elements.

p {
  white-space: pre;
}
<p>a b       c</p>

Use a monospaced font if you need each black space to take exactly one character width.

p {
  white-space: pre;
  font-family: monospace;
}
<p>a b       c</p>
like image 121
Stickers Avatar answered Sep 19 '22 09:09

Stickers


You can try to put &nbsp; between them. Like this:

<p>a b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c</p>
like image 34
Tân Avatar answered Sep 19 '22 09:09

Tân