I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

web developer guide

my books

Book cover of Pro CSS3 AnimationPro CSS3 Animation, Apress, 2013

my other blogs

Massive Head Canon: Intelligent discussion of movies, books, games, and technology.

my projects

A Sass color keyword system for designers. Replaces CSS defaults with improved hues and more memorable, relevant color names.

CSSslidy: an auto-generated #RWD image slider. 3.8K of JS, no JQuery. Drop in images, add a line of CSS. Done.

tipster.ioAutomatically provides local tipping customs and percentages for services anywhere.

Comments in HTML

html / elements

Estimated reading time: 1 minute

It is a very good working practice to comment your code in HTML. In all programming languages, comments serve two major functions:

As notes and reminders

Comments allow you leave yourself notes as to what sections of code do, and what they are there for. It is common for a developer to return to code that has not been touched in six months or more: comments allow you to quickly remember what each piece of code does.

As “traffic cones” around code that is problematic

Code surrounded by comment markup immediately ceases to work. Because HTML code is read from the top down, you can narrow down the cause of problems by removing sections from execution by surrounding them with comments, moving the start and ending comment markup around to analyse problems via a process of elimination.

Content, markup and code within comments does not appear on a web page, but can still be read by anyone with access to your source code. (In HTML this is as easy as using View / Source in the browser).


<!-- this is an HTML comment -->

Note that HTML comments are not tags; this can be confusing to many neophyte coders, as they appear to break all the rules of HTML. Comments may be placed over multiple lines.

<!-- this is a comment
 over multiple lines -->
comments powered by Disqus

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.