Is there an HTML space tag?

Question: Is there an HTML space tag?

It can be very frustrating to add a bunch of spaces to your HTML only to have them disappear because of how HTML handles spaces. An HTML space tag would be very convenient for creating spaces.

Answer:

There is no such thing as an HTML space tag. This is unfortunate, as HTML compresses all space characters (tabs, spaces, even carriage returns) down to one character.

This means that if you’re going to indent your paragraphs, you can’t simply type 5 spaces and then begin your text.

Alternatives to an HTML Space Tag

There are several options you have to create white space on your web pages:

  • non-breaking space
  • <br> tag
  • <p> tag
  • <pre> tag
  • CSS margin and padding properties

There are many HTML tags that you can use to modify your pages. With practice you should be able to get around the lack of an HTML space tag without too much trouble.

Format
mla apa chicago
Your Citation
Kyrnin, Jennifer. "Is there an HTML space tag?" ThoughtCo, Jun. 20, 2017, thoughtco.com/html-space-tag-3466504. Kyrnin, Jennifer. (2017, June 20). Is there an HTML space tag? Retrieved from https://www.thoughtco.com/html-space-tag-3466504 Kyrnin, Jennifer. "Is there an HTML space tag?" ThoughtCo. https://www.thoughtco.com/html-space-tag-3466504 (accessed January 16, 2018).