More Underutilized (X)HTML

Yesterday’s entry about definition lists was, I think, a good one for all web developers but especially so for the slightly less experienced ones.  So I thought I’d point out some other tags that can be very valuable but that don’t typically get the exposure they might otherwise deserve.  BTW, the “(X)” in the title is quite intentional since these all really apply to both :HTML: and :XHTML:.

All the phrase elements: <em>, <strong>, <dfn>, <code>, <samp>, <kbd>, <var>, <cite>

<address>: for mailing addresses, but also useful for signatures, copyright text, etc.

<del>: almost always more semantic and correct than <strike>

<fieldset>: great way to group <form> elements together and in many browsers it will be rendered as a box around the group.  Can be used with the <legend> tag to make a label for the box

<ins>: for text you insert at a later date

<label>: for use with elements inside a <form>; this can add functionality in many browsers so that clicking on the label activates the field

<q>: for short, inline quotes. Gecko-based browsers will automatically add quotes around this text as they’re supposed to; IE won’t.  You can always style them with CSS, though.

So there are a few of the more “forgotten” tags for you to mull over.  Obviously, you won’t use all of those tags for any given site/situation, but it’s good to remember that there are sometimes tags out there that are exactly what you need, but about which you may have forgotten.

This is an older entry and as such, it may be by a guest author or contain formatting problems / extraneous code. If you notice something wrong with the entry, please use the Contact page to let me know the entry title and issue.

Comments

Good point, Chris! I couldn’t agree more. Using semantic mark-up is quite essential.

In relation to your post, below is a good reference for definition list:

http://www.htmldog.com/guides/htmlintermediate/definitionlists/

I must say that I’ve never done anything that even considered the <dfn>, <samp>, and <kbd> tags.  Honestly didn’t know that <kbd> existed, heh.

I used the <dfn>, <kbd>, <var>, and <samp> tags quite extensively when writing the updated pMachine documentation; using them to (semi-)semantically designate things like files, paths, URLs, and menu items.

It worked out very well since I could easily style any of them and it meant I didn’t have to use something like a <span class="file">.

Well you could just use XML to do that and even get more precise semantically.  Frankly, I look at XML and still think it’s a big load of crap.

Leave Your Comment

Comments may be edited for content or deleted at any time. Civilized discussion is welcome. Anyone spamming, going way off topic, or otherwise being a jerk will probably be deleted or banned.

User Information

pMcode is allowed for comment formatting. pop-up mini reference

Personalization Options

Comment Security