HTML <!--...--> Tag
- Previous Page Tastaturkürzel
- Next Page <!DOCTYPE>
Definition und Verwendung
Kommentar-Tags dienen dazu, Kommentare in die Quelldateien einzufügen. Kommentare werden im Browser nicht angezeigt.
Sie können Anmerkungen verwenden, um Ihren Code zu erläutern, was Ihnen bei zukünftigen Bearbeitungen der Quelldateien helfen kann. Dies ist besonders nützlich, wenn Sie große Mengen an Code haben.
Example
A HTML comment:
<!-- This is a comment. Comments are not displayed in the browser. --> <p>This is a paragraph.</p>
Tips and Comments
You can use comment tags to "hide" scripts so that browsers that do not support scripts will not display them as plain text:
<script type="text/javascript"> <!-- function displayMsg() { alert("Hello World!") } //--> </script>
Note:The double forward slashes (//) at the end of a comment line are the JavaScript comment symbol. This can prevent JavaScript from executing the --> tag.
Global Attributes
Comment tags do not support any global attributes.
AboutGlobal Attributesfor more information.
Event Attributes
Comment tags do not support any event attributes.
AboutEvent Attributesfor more information.
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page Tastaturkürzel
- Next Page <!DOCTYPE>