What can I use to substitute    in HTML?

Viewed 73788

   is ugly, I think.

10 Answers

Margin and/or Padding. (css properties), like so:

<p style='padding-left : 10px'>Hello</p>

(It's worth noting that it's generally considered bad-practice to put an inline style like that; you typically declare a selector in an external css file and set the class/whatever appropriately.)

In CSS try:

white-space:nowrap;

In CSS, Add

pre{
  white-space: pre-wrap;
  white-space: -moz-pre-wrap !important;
  white-space: -pre-wrap;
  white-space: -o-pre-wrap;
}
<pre>
    is not ugly anymore
</pre>

&#160; is alternative but it's also ugly

Beautiful solution is available in css.

If u need space at start of paragraph the u can use

p {text-indent: 10px; }

If u need spacing between word use like this

H2 { word-spacing: 3pt }

see here for more options http://www.hypergurl.com/csstutorial7.html

You can give these style to html by inline, external and from in-page(<head>....</head>)

How about the letter-spacing and/or word-spacing CSS properties?

You should use margin or padding properties with your elements to adjust whitespace.

You need to use:

&nbsp;  non-breaking space: ' '
&emsp;  em space: ' '
&ensp;  en space: ' '
&thinsp;    thin space: ' '

SIX-PER-EM SPACE

<p>I will display &#8198;</p>
<p>I will display &#x2006;</p>

EN QUAD space example

<p>I will display &#8192;tt</p>
<p>I will display &#x2000;tt</p>

EM QUAD

<p>I will display &#8193;tt</p>
<p>I will display &#x2001;tt</p>

Table

Char    Dec Hex Entity  Name
    8192    2000        EN QUAD
    8193    2001        EM QUAD
    8194    2002    &ensp;  EN SPACE
    8195    2003    &emsp;  EM SPACE
    8196    2004        THREE-PER-EM SPACE
    8197    2005        FOUR-PER-EM SPACE
    8198    2006        SIX-PER-EM SPACE
    8199    2007        FIGURE SPACE
    8200    2008        PUNCTUATION SPACE
    8201    2009    &thinsp;    THIN SPACE
    8202    200A        HAIR SPACE
​   8203    200B        ZERO WIDTH SPACE

Basically you can replace 4 space with  

&emsp; == &nbsp;&nbsp;&nbsp;&nbsp;

If you want replace all &nbsp with simple spaces in your HTML source code and KEEP the spaces in browser render view, like pre tag, you can use in CSS:

white-space:break-spaces
Related