White space and comments? Like... White noise?

joeldiharce

Joel Diharce

Posted on September 5, 2022

White space and comments? Like... White noise?

...So I just found out that HTML ignores white space... (Rude...)

This concludes white space (for now at least, I'm sure there will be something I find out later...)

Anyway - COMMENTS!

This is super useful. If you need to make a note about your code, you can use the comment tags. The comments tags open with <!--, and then closes with -->.

Example Time!
Here is the code as written:
<!Doc type html>
<html>
<head>
<title></title>
</head>
<body>
<p>URGENT QUESTION: Is butter a carb?</p>
<p>URGENT ANSWER: <em>YES</em></p> 
<p>Immediate application fo butter commences</p>
<!-- Oh that dear sweet summer child... -->
</body>
</html>
Enter fullscreen mode Exit fullscreen mode
Here is the code as I intend the user to view it:

URGENT QUESTION: Is butter a carb?

URGENT ANSWER: YES

*Immediate application fo butter commences*

There wasn't much to go over in this video, so here's hoping for a more meaty subject in the next one! ;D

Disclaimer: if you use inspect/View Page Source, you will find that the code in the section named "Here is the code as I intend the user to view it" is missing parts from the section named "Here is the code as written". The reason they're missing is because both the doc type tag and the comments are visible when using markdown.
💖 💪 🙅 🚩
joeldiharce
Joel Diharce

Posted on September 5, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related