Sunday, May 1, 2011

How to markup scientific names in XHTML?

I would like to know the best way to markup scientific names in XHTML. This answer says I should use the <i> element, which I'm not too in favour of, unless of course, it is the right element to use.

I could use <span class="scientific">, but seeing as one of the first uses of HTML was to markup scientific documents, I'd imagine there'd be a better semantic hook for this sort of thing.

Also, is there any element to markup the common name of a scientific name?

Note: It looks like Wikipedia, or at lease this article is using <i> for scientific nams.

Edit: Would the <dfn> tag be appropiate?

From stackoverflow
  • dfn is for a definition of something.

    <p>The prefix cardio- means <dfn>of the heart</dfn>.</p>
    

    As far as I can see in the list of HTML 4 elements nothing specifically fits the bill. This leaves you with a few options:

    <span class="scientific">cardio</span>
    

    The semantics are added by the class, and so this is probably the most correct way, technically. However, it does have the downside that without your CSS, it won't appear different in any way to the surrounding text. Another option might be this: /me prepares to duck for cover

    <i class="scientific">cardio</i>
    

    Now before I get my head bitten off for using the verboten element, <i>, consider that it is no less descriptive than using <span>, and even if a stylesheet were missing, you'd still get vaguely the correct formatting. Just make sure you add the class attribute.

    alex : Good answer, Nick. Hopefully you don't incur any downvotes from people who see and go urgh! I think I'll go with as it is used by Wikipedia and it seems to fit the bill. Thanks for the answer.
    nickf : oh, Wikipedia doesn't use any semantics at all in its markup, so I wouldn't use it as a guide. Click Edit on any page and you'll see why. Rather than get their users to learn the correct classes to use, etc, they go for a very simple markup... one step back from WYSIWYG, really.
    alex : Yeh, and I bet they don't use or with their revisions?
    nickf : haha oh man, that'd be so messy.
    alex : Nick, according to http://htmlhelp.com/reference/html40/deprecated.html it hasn't been deprecated, just has lost it's presentational meaning... it does not mean italicize text anymore...
    alex : it's also listed here: http://www.w3.org/TR/html401/index/elements.html
    nickf : oh, well there you go!
    alex : It's interesting... most people (including me until recently) though and were deprecated.
    porneL : Your example is wrong. http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-dfn-element It should be

    The prefix cardio- means of the heart.

    nickf : oh that's... well... different to what I had expected. Looks like dfn might actually be the right way to do it!

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.