DEV Community

Joel Diharce
Joel Diharce

Posted on

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.

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay