Why do we need to use 2-space indentations?


#1

Question

If the spacing in our HTML documents doesn’t affect the positioning of content on the page, why do we need to use 2-space indentations?

Answer

Experienced developers use indentation and vertical spacing to keep their code neat and legible. Highly readable code improves maintainability, aides collaborative efforts and makes for a better developer experience overall.

Within our HTML, consistent indentation should be used to illustrate nesting. For more info, check out this chapter.


FAQ: Learn HTML Elements - Intro to HTML - Line Breaks
#2

I’d like to know, though, why 2 spaces? In most other programming languages tabs are usually 4 spaces (or, though they’re a nightmare to use, 8).