Numbers and units (was Re: [whatwg] Feeedback on <dfn>, <abbr>, and other elements related to cross-references)

On Wed, Apr 23, 2008 at 11:42 AM, Ian Hickson <ian@hixie.ch> wrote:
>  On Tue, 22 Apr 2008, Christoph Päper wrote:
>  >
>  > I forgot so far to mention my dearest English abbreviation, actually it
>  > is a (NIST-recommended) unit symbol and thus without the abbrev dot:
>  > 'in' for inch. Unit symbols and abbreviated function names (e.g. 'sin')
>  > also may need markup (and styling) to keep them upright inside italic
>  > mathematic text (not every italic math is a |var|).
>
>  Interesting point.

This reminds me... I want a space between numbers and units in many
cases, e.g. "5 in" or "24 hours". A minor but regular nuisance with
this is the wrapping of text... it's not good practice to have a line
break between the number and associated units. The solution for now is
wrapping an element in a tag and defining 'nowrap' in the css.

After reading the above, I'm imaging this ...
<span class="measure">24 <abbr title="hours">hrs</abbr></span> ... and
wondering if there's an opportunity to simplify the markup.

(One solution I'd contend is that unit abbreviations are commonly
defined - in dictionaries, or as SI units - thus we don't need to keep
redefining them as abbreviations in webpages.)

I quite like the introduction of time though, it will be very elegant for this:
<time datetime="...">5:00 am</time> (can use css to prevent wrapping
between digits and 'am').

And I know we have <meter>, but it's really for proportions/ratios
rather than standalone measurements. I'm sure there's value in having
these numbers (and their associated units) more concretely marked up:
- styling (numbers and units, numbers separate from units)
- identifying unit abbreviations (e.g. "5 in long" - 5 inches - vs not
"5 in 100 people surveyed" - not inches)
- script manipulation... being able to operate on the numbers without
parsing out units out of the strings, maybe constructing <meter> and
<progress> elements from these values ... maybe even to the point of
doing something interesting with the units.
- gets a bit more complex, but identifying data types like prices (and
associated currency) seems useful to me ...

I don't know mathml so maybe it can already do some/all of this magic.
Sorry for the tangent ...

cheers
Ben

Received on Wednesday, 23 April 2008 12:18:36 UTC