When you are designing your website, there are many instances that require you to comment out code in your website. Commenting code is good for diagnosing website problems, hiding code instead of deleting the code, placing notes in a file to explain what was done, and many more reasons. This article will explain the basics of commenting code in your website files.
HTML Comments
HTML comments are specifically designed to comment out code when you are in an HTML coded document. Below is the syntax for HTML comments.
HTML comment
<!-- <code to be commented out> -->
Example of an HTML comment
An Example of a usage of this is shown in the following code.
<html><head> <title>Document</title> </head><body> <!-- This is a comment --> <p>A paragraph in your site</p> <!-- This is code commented out <h1>Commented Title</h1> <p>A paragraph that is commented out.</p> --> </body></html>
CSS, JavaScript, and PHP Comments
CSS comments are done in the CSS .css stylesheet or in the Internal Style sheet. JavaScript comments can be placed inside HTML documents or in a .js file where JavaScript is ran. PHP code will be in .php files between <?php
and ?>
code. The following code shows the syntax for commenting out CSS, JavaScript, and PHP code.
Single Line comment
// <code to be commented out>
Multiple Line comment
/* <code to be commented out> <Other code to be commented out> <Some more code to be commented out> */
Example of PHP comment
An Example of a usage of this is shown in the following code. Below is showing PHP code; however, you use the same process to comment JavaScript and CSS.
<html><body> <?php // This is a comment on one line echo '<p>HTML code echoed by PHP.</p>'; /* This is code commented out echo '<h1>An HTML Title from PHP</h1>'; echo '<p>HTML code echoed by PHP.</p>'; */ ?> </body></html>
I’ve been told that in order to find the code of my faulty website the new dev needs to get it from the server. I would like to kmow whehter this is a fact and whether is a difficult task. Thanks
This depends on the effects of the malware on your website. Server access is one of many options. You could give them a full server backup. If you believe it’s only affected a website, you could share FTP access or a website backup of that website only. I recommend first contacting our Live Support as there are more options depending on your hosting plan.
Thanks for providing authentic content about Html
You’re quite welcome, happy to help!
Thanks for the share, appreciated.
Thanks for the share, appreciated.
thanks for sharing information.
You’re welcome, thanks for your feedback!
Very Great
Thanks, we appreciate your feedback!
Excellent info on Web Design …!!
Appreicable post and Great Job by Author.
thnx 4 this information i tried this and it works thnx
Thanks for your feedback. Be sure to click the Yes button next to: “Did you find this article helpful?” This helps others in the community quickly locate the most helpful articles!
Thaks to share such a nice information!!
this is best
It is very nice and wonderful to get ideas
Thank for information about HTML. It is realy useful for me. HTML coding is helpful in giving some idea.
Excellent effort to make this blog more wonderful, and attractive.
Charles, you’re most welcome! We’re always glad to be of assistance! Have a great day!
thanks for helpful tutorial!
Perfect
Thank you so much it helped
Nice Comment format
Hello
Thanks for sharing this blog….
Awesome!! Just used this to edit some JS.
I had never thought of this until now. Much better solution than deleting code.
Hello roberthoot,
Thank you for your question. You can create posts in the InMotion Hosting’s User Submitted section.
You can also setup your Google Authorship, so you are listed as a contributor to our site.
Thank you,
John-Paul
I’ve been told that in order to find the code of my faulty website the new dev needs to get it from the server. I would like to kmow whehter this is a fact and whether is a difficult task. Thanks
Hello Lavinia,
As this question does not relate to the article topic, it has been moved and created as a new question. To maintain topic relevance please only comment on related articles. You can always ask a new question if you cannot find your answer in our article lists.
Kindest Regards,
Scott M
thank
Thanks for the share.
Very Nice information about HTML.
Thanks
Nice post.
very useful for php coding thank you so much…