mpen mpen - 1 year ago 93
HTML Question

What tag should I use for file size w/ alt text?

There's a

tag for times, but what should I use for file size?

Right now I'm using,

<abbr title="11,201 bytes">10.9 KB</abbr>

But I'm wondering if there's something more appropriate.

I do want the tooltip to appear on mouse-over.

Answer Source

There's no exact tag for what you're looking for. I wouldn't use an <abbr> since they're reserved for abbreviations and may affect some web-crawlers, etc. There is a good list of HTML tags here for reference.

However, for your use case I would adopt a custom-styled <span> tag. It still supports the title attribute so the tooltip will appear nonetheless.

If semantics are a concern, consider looking at adding aria-label attributes so your HTML is up to the ARIA spec.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download