Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which HTML element makes the most sense for code annotation?

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.

Example code on jsFiddle

Now the questions

  1. 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.
  2. Is there an element that the actual footnotes (we're calling them annotations) should be wrapped in?

Any insight would be greatly appreciated.

like image 451
Matt Crest Avatar asked Aug 25 '11 16:08

Matt Crest


People also ask

What is the most important element in HTML?

<title>: the most important element of a quality Web page The <title> element in HTML is designed to provide a short piece of text that should stand for the document in cases such as: window title bars. bookmark lists. result lists from search services.

What is the HTML tag used to display the most important or main headings?

Content (Container) Tags Headings. H1 is the main heading, H2 is secondary, etc. A container for in-line content, such as content inside a paragraph.


1 Answers

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.

like image 69
steveax Avatar answered Oct 08 '22 10:10

steveax