In this DaddyDev lesson, Ryan E. Hamilton teaches the kiddos about HTML Comments, or the <!– … –> tag!

HTML Comments are a coder’s way to leave notes (i.e. comments) in the source code of the HTML page and/or keep things hidden from the browser. If there’s any HTML that you want to keep hidden from the the browser, just wrap it with an HTML Comments tag. <!– … –>

Comments [in ANY programming language] are a good way to explain code to yourself and other coders. They are also a good way to hide experimental code, code under construction, code that isn’t quite perfect, etc. If you need to hide anything, COMMENT IT OUT!

Code comments are also a fun way for coders to geek out and have a little fun. See?

Enjoy! 8)

DaddyDev 12: Leaving Comments

Sample Code

<html> 	 	<head> 	</head>  	<body> 		 		<h1>The <!-- BAD --> Good Boy</h1>  		<p>Once upon a time, there was a very <!-- BAD --> good boy, and all he did was <!-- stay in the house --> go outside and <!-- play video games --> read books all day.</p>  		<!-- Blah. Blah. Blah. Blah. Blah. Blah. Blah. -->  	</body> 	 </html>

Code View

DaddyDev 12: Leaving Comments

Browser View

DaddyDev 12: Leaving Comments