Which HTML element is most suitable for code annotation?

I am working on a web application that has codelists. Some lines of code contain notes attached to them (I think comments, but not inline comments on the code β€” more like an author explaining something).

When the user hovers over the footer type indicator, a tooltip displays a comment.

Sample code in jsFiddle

Now questions

  • What element does it make sense to wrap the comment indicator in? I played with the idea of <mark> , but it seems to me that stretch. Someone suggested that the <object> might make sense. Again, not sure.
  • Is there an element that contains the actual footnotes (we call them annotations) to wrap?

Any understanding would be greatly appreciated.

+6
source share
1 answer

I thought <aside> might be useful, but probably the footnote pattern is 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 a note. You can do worse than follow this.

+3
source

Source: https://habr.com/ru/post/895898/


All Articles