Two small quirks of HTML surprise a lot of beginners: tag names don't care about capitalization, and extra spaces in your code often just... disappear in the output.
<P>, <p>, and <P> all mean the same thing to a browser. Attribute names work the same way.
<P>This works.</P>
<p>So does this.</p>Works either way — lowercase is the convention
The W3C recommends lowercase in HTML, and it's required in stricter formats like XHTML. Every example on this site uses lowercase for that reason.
A browser reduces any sequence of spaces, tabs, and line breaks down to a single space when displaying text. Indenting your code for readability never changes how it renders.
<p>This paragraph
contains a lot of spacing
and line breaks.</p>The browser output is: This paragraph contains a lot of spacing and line breaks.
| Need | Use |
|---|---|
| A single space that never collapses | |
| Whitespace exactly as typed — code, ASCII art, poetry | The <pre> tag |