How to Include Comments in HTML Website Code

How to Include Comments in HTML Website Code thumbnail
HTML comment display

When designing a website in HTML, including comments can help you keep track of where you are in your design, provide designer-specific information or remind you of important code snippets. Including comments in HTML is easy.

Things You'll Need

  • Text editor
Show More

Instructions

    • 1

      Learn the special code for including comments in your HTML website code. This code can be used in all browsers including Internet Explorer, Firefox, Opera and others. It looks like this: <!--Comment--> The brackets, exclamation mark and dashes tell the internet to ignore the information contained within. It will not affect your HTML.

    • 2

      Write the HTML code for your website or web page in the text editor of your choice. Be sure to use proper code, syntax and style for all website-design work.

    • 3

      Determine why you need comments in your HTML code. There are many reasons you might want them. Some website designers use comments to keep track of sections of a website. For example, they may make a comment before and after the sidebar code. Some include comments in HTML to brand their work by including internal copyrights.

    • 4

      Include structure-specific comments in your HTML by inserting this code: <!--Body starts here--> and <!--Sidebar starts here-->. This type of comment will help you keep track of where you are in your website code when you are editing or redesigning at a later date.

    • 5

      Insert your name or brand-specific HTML comments if you are giving away or selling your website HTML template or designing specifically for a client. Use something like <!--Designed by Happy Web Design--> in the HTML code to claim the code as your own. You can set up a search-engine alert for the words used in the comment, meaning that you will be notified when the template is used or if it is sold illegally.

Tips & Warnings

  • Use HTML comments sparingly or your code will be messy.

  • Do not use HTML comments to fake search-engine optimization.

Related Searches:
  • Photo Credit Melanie Schwear

Comments

You May Also Like

Related Ads

Featured