问题
I want to display comments in my HTML source, but only in the source and not on the actual rendered content of the page. For example, when a user right clicks their browser window and selects "View Source", I want the comments to be visible for them to read there, but I don't want the comments to be visible on the actual rendered website.
I tried
<span style="visibility: hidden;">
Joe Hancock - 04/16/12 - Some comment
</span>
But doing this takes up actual room on the webpage (white space) and really throws off my styling.
Anyone know of an good way to do this?
回答1:
<!--This is a comment. Comments are not displayed in the browser-->
HTML Comments
回答2:
Try this:
<!-- Comment goes inside here -->
回答3:
1<div style="display:none">This is hidden</div>2
来源:https://stackoverflow.com/questions/10179256/how-to-display-comment-in-page-source