W3C home > Mailing lists > Public > public-html@w3.org > April 2008

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

From: Ben Boyle <benjamins.boyle@gmail.com>
Date: Wed, 23 Apr 2008 22:18:01 +1000
Message-ID: <5f37426b0804230518p1ef0eaf1j9b666ea485cc38dd@mail.gmail.com>
To: "Ian Hickson" <ian@hixie.ch>
Cc: public-html@w3.org, "whatwg List" <whatwg@whatwg.org>
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

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:54 UTC