!-- -- comment
HTML5 comment
allows you to comment your source code for various reasons:
About comments
- are optional
- multiple comments allowed per HTML5 document
Display & support comment
- display in browser »video
- display: none





Parents, children comment
- comments nested within elements »comment parents
- elements nested within a comment »comment children
»examples
Attributes comment
not applicable
Warning
Within a comment, the next characters are not allowed [where are not allowed]: >[start], ->[start], --[contain], -[end] »video
Avoid adding comments within elements that expect text content: e.g. title, textarea.. (the risk of being included in the text content) »video
Syntax comment
1 | <!–– add a comment here ––> »example |
Attributes and Values comment (comma separated)
not applicable
Video demonstration comment
HTML5 Comments Tutorial
min | video details |
---|---|
00:00 | video demonstration comments in HTML5 |
00:05 | a comment allows you to comment your source code for various reasons: 2 of them presented next |
00:17 | this article presents the section element |
00:20 | reason 1: explain your code (for you in order to easily maintain) or (for others: to maintain, test, improve,... ) |
00:20 | the start part of a comment |
00:23 | the end part of a comment |
00:26 | commented part |
00:41 | note: the 2 comments do not display in browser |
00:49 | reason 2: irrelevant code (which will no longer display in browser) |
00:50 | let's say that part of code represents irrelevant⁄no longer needed code |
00:53 | commenting that part (goes between the start part and the end part of the comment) |
01:00 | no longer displayed in browser |