HTML – Adding comments to HTML

As you create more pages, it may become difficult for you to understand your code in the future unless you use comments. By adding comments to your code, it could be a valuable reference guide for you when you look at your code in the future.

Ideally, comments should be added to indicate what the code does.

Comments are personal; so add anything that you think is impotent about your code. Remember, as you add comments to your pages, the file size of the web page will increase. That, in turn, may increase web page download time. So avoid use of excessive comments.

As you first start working with HTML, you may start by adding comments to every single line to remind you of what the code does. As you develop more experience and gather more knowledge about HTML, you will learn to comment only major parts of your web page. You may, for example, comment the width of nested tables you are using in your web page:

In HTML, a comment begins with <!-- and ends with -->.

Any text you place after <!-- is comment.

Browsers ignore comment text. Again, comment is for your reference; it does not get displayed on the web page. In a comment, you can freely include special characters, such as ampersands, quotation marks, and angle brackets. Your comments can also span multiple lines. The browser will stop ignoring text once it reads -->.

Example of a single line comment:

<!--This is a small comment-->

Example of a multi-line comment:

<!-- This comment is long. It is displayed on more than one line. Adding multi-line comments in HTML is easy as adding a single line comment. Whether the comment is single line or multi-line, it starts with <-- and ends with --> -->

Important points about comments:

  • Use comments as a reference guide. Avoid use of excessive comments.
  • Add comments to major parts of your code; or for parts, that you are unsure of.
  • Use of comments is a great way to communicate with other people working on the same web page.
  • Start your comment with <-- and end with -->
  • Browsers and search engines ignore comments.
SOURCE

LINK

LANGUAGE
ENGLISH

3 thoughts on “HTML – Adding comments to HTML”

  1. My computer (xp) kept on showing this message about this csrss.exe thing….i have no experience with computers but i looked it up and it said that it’s a system file or it cud be a virus??? i searched my computer for csrss.exe files and 3 results came up….i’ll copy them onto this but can anybody tell me if any of these are viruses or not? please CSRSS.EXE-03323C54.pf location=C:\WINDOWS\Prefetch csrss.exe location=C:\WINDOWS\system32 csrss.exe location=C:\WINDOWS\ServicePackFiles\i38… P.S. i scanned them with AVG but it said that it has no infections…i don’t know if i shud trust AVG I also scanned my whole computer with AVg and the sign about the csrss.exe doesn’t come up anymore but i need to know if any of those files are viruses or not…thanks for the help :)
    Unlock iphone
    iPhone Unlock
    How To Unlock iPhone
    Unlock iPhone 3G
    Unlock iPhone 3GS
    Can You Unlock iPhone

  2. Hi Rablillonry, for the CSRSS.EXE issue there is no problem, it is not a virus or malware, it is an operating system component that controls basic graphics operations about the Windows System,you should leave it alone :)

    The .pf file relative to CSRSS.EXE process is only the prefetch system of Windows XP to load quickly system components and other common files in RAM to increase system responsiveness. :)

  3. I used to be more than happy to search out this net-site.I wanted to thanks in your time for this wonderful read!! I positively having fun with every little little bit of it and I have you bookmarked to take a look at new stuff you blog post.

Comments are closed.