HTML Comments
Comments in HTML <!-- -->
The syntax of an HTML comment is as below.
Code
<!-- This is commented section -->
Can you guess how should one comment the following markup?
Code
<a href=”index.php”>Image</a>
Did you write something like this?
Code Output
<!--<a href=”index.php”>Image</a>-->
The above commented markup is not displayed by the browser, So the above "commenting" is very much correct, but the elegant way to comment out the above HTML markup is as given below
Code
<!--a href=”index.php”>Image</a-->
Why does one put a comment after all?
You should put comment
- To let code or markup understandable by other persons also after long period of time.
- To try alternatives. Your current code looks good, but you think that just one more ol tag will make it excellent. In such situations you should either make a copy of your existing code or comment out the lines to try the alternative.
- To keep track of modifications.
- 847 reads
