哪个 HTML 元素对于代码注释最有意义?
我正在开发一个具有代码列表的网络应用程序。某些代码行附有注释(认为是注释,但不是内联代码注释 - 更像是作者在解释某些内容)。
当用户将鼠标悬停在脚注类型指示器上时,工具提示将显示注释。
现在问题
- 什么元素最有意义来包装评论指示器 在?我考虑过
的想法,但我感觉这是一个 拉紧。有人建议
- 是否有一个元素是实际的脚注(我们称之为 注释)应该包裹在?
任何见解将不胜感激。
I'm working on a web app that has code listings. Certain lines of code have notes attached to them (think comments, but not inline code comments - more like an author explaining something).
When a user hovers over the footnote type indicator, a tooltip will display the comment.
Now the questions
- What element would make the most sense to wrap the comment indicator
in? I toyed with the idea of<mark>
, but I get the feeling that's a
stretch. Somebody suggested the<object>
tag could actually make sense.
Again, not sure. - Is there an element that the actual footnotes (we're calling them
annotations) should be wrapped in?
Any insight would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为
维基百科使用
N
作为指标,用于注释。你可以做比遵循更糟糕的事情。
I was thinking that
<aside>
might be useful, but probably a footnote pattern is really the closest match.Wikipedia uses
<sup id="cite_ref-N"><a href="#cite_note-N">N</a></cite>
for the indicator and<li id="cite_note-N">Note</li>
for the note. You could do worse than follow that.