Viewing Source and comments

Viewing Source Code

It is possible to view the HTML code that powers all the web pages on the web. Almost every browser supports an option for viewing the source code for any web page on the web. If you right click on a page and choose the “View Page Source” option, the entire HTML code will be open in a new window. Another option that is available in most browsers is the “Inspect element” option. Selecting this option opens the developer tools window with the element the pointer is resting on. It is possible to view the CSS and JavaScript files separately. These developer tools are extremely useful for viewing the page in case of errors in the file. It is possible to edit the source code and view the results immediately. Any corrections can be redone in the original source file after finding the errors.


Like every other programming language, HTML supports comments. Comments are parts of the web page that are skipped over by the browser. We can use comments to leave information that will be useful for future reference. The comments are useful for a team of developers working on a website. They could leave comments as a method of communicating what needs to be changed or added. They are also useful for solo developers. If someone returns to a project after a long time, they might have forgotten the details about the web page. We can read the comments to get an idea about the web page. Commenting is an important habit for any web developer.

<!-- This is a comment. The browser just ignores this part. -->

Using Comments for debugging

In some situations when an error occurs in a web page, we can use comments for finding the location of errors.  We can comment out portions of text until the errors disappears. Then the error will be most likely in the section inside the comments. We can repeat this process for all the errors. Programmers use this technique for detecting errors and this also works for web pages.