Web Design Made Simple Web Design Made Simple

debbie T Designs - Web Design Made Simple

xhtml Comments

Comments are a Designer’s Best Friend

So how does a designer keep track of all that code? Well, with lots of practice, xhtml can eventually be memorized and feel as natural as reading and writing your own native language.

But even the most experienced coders still need a little help sometimes. Using (x)html comments are a great way to leave little reminders and notes in your code.

<!-- This is a comment -->

<!-- A comment can span multiple lines.
A comment can include a second line.
or a third line. -->

The cool thing about comments is that they are not visible when viewed in a browser! Your notes will remain unseen except by someone viewing your source code.

Let’s see a couple of comments in action:

<body>
<!-- the first heading -->
<h1>Debbie’s Favorite Foods</h1>
<p>I would like to share my favorite foods with you.</p>
<!-- subheading Italian starts here -->
<h2>Italian Dishes Rock My World</h2>
<p>This might be my favorite food of all time. Scrumptious meatballs and chicken parmesan are yummy main dishes. I just love pasta. Give me red tomato sauce, pesto sauce, or garlic and oil. I love it all!</p>
<!-- Subheading Chinese starts here -->
<h2>Chinese Take-Out For Dinner</h2>

Some Facts on Comments:

  • Start a comment with a <!-- and end it with a -->
  • Always include a [space] after the opening <!-- and before the closing -->
  • Don’t forget the !
  • Do not include any double dashes (--) inside the comment text. You may use single dashes - or an = equal sign. Only use the double dashes to open and close comment.
  • You cannot nest a comment in another comment.

Did you happen to notice the xhtml comments I inserted in the 2coding.html file?

What do you want to learn next? « Line Breaks & RulesW3C Validation »

Leave a Comment

If you would like to make an observation or suggestion, please take the time to write a comment. If you prefer to contact me privately, there is a contact form.