小智 8
您显示的评论不会导致任何显示问题,但如果您这样做:
<!-- My comment ---------- -->
Run Code Online (Sandbox Code Playgroud)
你可能会遇到Firefox的问题.这是因为两个短划线表示注释的结尾,而>是结束注释标记.从技术上讲,这是有效的:
<!-- My -- comment >
Run Code Online (Sandbox Code Playgroud)
所以可能发生的事情是你的评论没有在你认为应该的地方结束,因此一些内容仍然被注释掉,或者评论显示在页面上.
更多细节可以在这里找到:
http://weblog.200ok.com.au/2008/01/dashing-into-trouble-why-html-comments.html