From the course: HTML Essential Training

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Formatting HTML

Formatting HTML

- Let's talk about what's going on inside the HTML file and options we have for formatting our code. As I've mentioned earlier, for the most part, HTML doesn't care about spaces, tabs, carriage returns. There are a few exceptions. If you use a <pre> element or a <code> element or a <textarea>, or if you use CSS to change how the white space is handled, in those situations, extra space, returns, and indentations can count. But most of the time, the browser will ignore everything having to do with spacing beyond the presence or single space. Let's look at an example. Here, I've typed up a paragraph with the extra spaces between each sentence, but the browser is going to ignore them. Another way programmers keep code easy to understand is by "documenting it", by putting comments in the code to explain what's going on. In HTML, you add comments to code by typing less than, exclamation point, dash, dash. Everything after that…

Contents