Is there a way to comment multiple lines... which already have some comments in them?
i.e.
<html> <!-- Multi-line comment begin <head> <!-- This script does abcxyz --> <script>...</script> </head> <body> Hello world! </body> Multi-line comment end --> </html>
It seems that even SO's syntax hilighting won't accept this...
How to Write Inline Comments in HTML. You can also add comments in the middle of a sentence or line of code. Only the text inside the <! -- --> will be commented out, and the rest of the text inside the tag won't be affected.
Look for shortcuts in your editor to do nested comments in html. This can with one keypress (un)comment a block of code and do a substitution of <! -- inner-comment --> to <!~~ inner-comment ~~> (just like guido's answer suggests), making commenting and uncommenting blocks just as easy as it is in other languages.
In HTML a comment is placed between <!-- and --> <!-- this is a (multi-line) HTML comment --> Note that most scripts ignore this comment style, as it used to help hide scripts from browsers that didn't support scripts. so in scripts you use other commenting markings.
Types of HTML Comments: There are three types of comments in HTML which are: Single-line comment. Multi-lines comment. Using <comment> tag.
I think the key point is this:
Note that comments are markup.
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
This is not valid markup:
<div <span/> />
... so neither is the one you mention.
Since all my sites are written in PHP I normally comment out code with PHP comments:
<?/*?> <div>...</div> <p>...</p> <?*/?>
Perhaps you can use a similar trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With