Multiple spaces in html?

Just a Beginner looking for the best way to place multiple spaces in html code?

Hi pavlacalm, welcome to the forums.

Spaces can be many things, please elaborate what type of spaces are you thinking of?

You are probably looking for  , as in HTML Entities. If that does not help then please clarify your question. Look at the part that says:

To add real spaces to your text, you can use the   character entity.

2 Likes

  is what I use a lot of.

1 Like

  may be the answer you think you are looking for.
But I would always question the use of chaining multiple &nbsp;s, as I would chainging multiple <br>s.
I always cringe when I see either either of those abused.

4 Likes

@SamA74 :relaxed: yeah been there done that myself, and didn’t like.

Yes I agree they are often used too much but I think HTML should often provide better solutions, such as the tab character is not recognized and there is not a direct equivalent. It depends on what needs to be done. Sometimes margins are more appropriate.

3 Likes

As @Erik_J is asking, this does depend on the context of what really is being asked.
Adding whitespace to the actual code, with tabs or spaces can do a lot for readability.
Adding space between entities on the visual web page, that is presentational and to be handled by CSS, padding or margins look likely.
&nbsp; and <br> do have their use, but are too often misused.

3 Likes

A trick is to alternate &nbsp; with ordinary spaces: that way you don’t need so many &nbsp; :grinning:

In my view it’s usually better practice to use <span> elements within paragraphs with left and right margins applied to give the desired spacing.

Using either method with responsive text, care is needed to ensure text wraps OK.

To give alignment like desktop publishing tabs, use an HTML table.

1 Like

@Archibald and @ladans37, I guess we’ll have to wait for @pavlacalm to give us a clue of what he wants to achieve.

1 Like

@Erik_J maybe so :slight_smile:

sorry about that. &nbsp; is what I was asking for.

1 Like