Lesson 5 - HTML comments and tags

HTML comments

It's always good practice to insert comments which help others understand your code. Note that there is a difference between comments which describe sections of code, and commented out code. Commented out code is more often than not considered bad practice and is not advised.

An HTML comment can be inserted as follows:

<!-- Your comment here -->

Conditional comments are applied to a particular browser version:

<!--[if IE 8]> This line will only show on Internet Explorer 8 <![endif]-->

Code tags

Code tags allow code to be inserted into HTML in a monospace font to indicate a line of code.

int numberOfUsers = 5

Pre tags

Pre tags differ from code tags in that they preserve whitespace and line breaks.

**bold text** with a some s t r a n g e spacing and a line break

Should you want to show code snippets spanning multiple lines you can insert code tags within pre tags