How to display comment in page source

為{幸葍}努か 提交于 2019-12-13 04:08:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!