Coder Perfect

How to use HTML/CSS to insert spaces and tabs in text

Problem

Possible ways:

<pre> ... </pre>

or

style="white-space:pre"

Anything else?

Asked by Yeseanul

Solution #1

To insert tab space between two words/sentences I generally make use of

  and  

Answered by Giri

Solution #2

In circumstances where the space’s width/height exceeds  , I normally use:

For horizontal spacer:

<span style="display:inline-block; width: YOURWIDTH;"></span>

For vertical spacer:

<span style="display:block; height: YOURHEIGHT;"></span>

Answered by Japol

Solution #3

> for > (greater than, entity number >) and less than (entity number <).

HTML Entities has a comprehensive collection of HTML entities.

Answered by Halim Qarroum

Solution #4

Try  .

Special Characters: According to the documentation:

Answered by Abhishek Goel

Solution #5

In HTML, there are several different types of spaces.

 makes four spaces between the text-   &ems

  Adds two spaces between the text –

 Makes a regular spacing between the text –

produces a narrow space (like regular space but with a tiny difference – “&thinsp”);

“/br>” is the space between sentences.

This link may be of assistance to you. Check out [https://hea-www.harvard.edu/fine/Tech/html-sentences/html-sentences/html-sentences/html-sentences/html-sentences/html-sentences/html-sentences .html]

Answered by Vivek Budithi

Post is based on https://stackoverflow.com/questions/9792849/how-to-insert-spaces-tabs-in-text-using-html-css