W3C home > Mailing lists > Public > www-style@w3.org > January 2008

Re: [Fwd: Re: [whatwg] simple numbers]

From: Keryx Web <webmaster@keryx.se>
Date: Sun, 13 Jan 2008 20:27:01 +0100
Message-ID: <478A6605.5080005@keryx.se>
To: www-style@w3.org

David Woolley skrev:
>> CSS:
>> td:after {
>>     content: " USD";
>> }
> Support for this is far from universal.

You've misunderstood my question. It's not what is being supported 
today, but how UAs are *supposed* to support it. I.e. how would an UA, 
that is acting according to the spec, render generated content in table 

> More importantly, the currency appears to be essential for the content, 
> whereas anything inserted by style sheets doesn't really exist in the 
> document.  I.E. you seem to be confusing content an styling.

I see your point. However, separating actual numbers from the unit makes 
a lot of sense as well.

A. It provides for easier scriptability.

B. It is the common convention already in use in spreadsheet software.

C. It will make the (X)HTML markup considerably smaller, especially if 
we can attach units to cols or colgroups. (That might not be possible, 
though, because of inheritance rules.[1])

The following, modified example from Web Forms 2.0[2] also shows how it 
would be easier to set units with CSS generated content:

     <input name="a" type="number" step="any" value="0">
     <input name="b" type="number" step="any" value="0">
   <output name="result"
           onforminput="value = a.value * b.value">0</output>

I can imagine many scenarios where it would be beneficial to have 
currency units on the output element, as in:

output[name=result]:after {
     content: " USD";

However, those characters should probably not be submitted to the server.

Another way to set units might be through an (X)HTML attribute. This 
discussion was started on the WHAT-WG list, as I thought we might even 
need a special number element. That would enable browsers to apply 
special parsing rules for numbers and also give authors a fallback. I.e. 
one could provide a formatted number, with units, that would be 
presented in legacy browsers in the most easily readable format.

Lars Gunther

1. http://ln.hixie.ch/?start=1070385285&count=1
2. http://www.whatwg.org/specs/web-forms/current-work/#the-output
Received on Sunday, 13 January 2008 19:27:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:33 UTC