If you're really stuck with some piece of HTML – pre-rendered at some uncontrollable source – which contains comments, and you need to make sure none of it is rendered on your page, you can always wrap it with a script
tag like below, only thing is, you can't comment out script
tags this way.
<html>
<head>
</head>
<body>
<!-- multiline "comment" below using script type="text/html" -->
<script type="text/html">
Hello world!
<!-- Look at me, I'm a comment :) -->
<div>Yeah, whatever, I'm an element..</div>
</script>
<span>Who cares, span is the man, the only visible one anyway!</span>
</body>
</html>
If you need to comment out script
tags, you could use a textarea
as wrapper instead, off course doing it this way, you can't comment out textarea
tags.
<html>
<head>
</head>
<body>
<!-- multiline "comment" below using textarea style="display:none;" -->
<textarea style="display:none;">
<script>
alert("which won't show up..");
</script>
Hello world!
<!-- Look at me, I'm a comment :) -->
<div>Yeah, whatever, I'm an element..</div>
</textarea>
<span>Who cares, span is the man, the only visible one anyway!</span>
</body>
</html>