W3C home > Mailing lists > Public > www-style@w3.org > April 2012

[css-selectors] Non-String Attribute Selection

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Sun, 8 Apr 2012 11:08:40 +0200
Message-ID: <5B348AF97C044F8B9BC0B28F8CD6C737@FREMYD2>
To: "CSS 3 W3C Group" <www-style@w3.org>
Hi,

Here’s a small proposal for inclusion in CSS Selectors 4 or 5: adding the possibility to consider attribute values as numbers instead of strings.

CSS:

    element[n:attribute<100] {    color: red;        }
    element[n:attribute=100] {    color: violet;    }
    element[n:attribute>100] {    color: blue;      }

HTML:

    <element attribute=”99” /> red
    <element attribute=”100” /> violet
    <element attribute=”100.0” /> violet
    <element attribute=”100.0px” /> violet
    <element attribute=”111” /> blue
    <element attribute=”string” /> inherit
    <element attribute=”” /> inherit
    <element /> inherit

And if the people here are in a good mood, we could maybe even add other types like dates (d:) and integers (i:). This new syntax ([cond:            ]) also opens the door to more condition types in a good-looking way, I think.

Have a nice Easter,
François
Received on Sunday, 8 April 2012 09:08:54 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT