Conditional CSS sections based on property support

I think that it would be useful to be able to say ‘everything must be 
!required’. Because if you have a certain portion on your page that you 
only want to style in a certain way, you would want *everything* to be 
work, or nothing, and writing down !required for *each and every 
property* in a selector seems bothersome and bloated.

Because in practice, will an author not want every property in such a 
‘requirement block’ to be supported? If not, I can see a situation 
arising where page authors will often be singling the requirement down 
on a single ‘advanced’ property (based on browser testing, likely), and 
assume that the other properties they use just as much based on that 
singled out one.

For example, would I develop a browser which supports opacity: but not 
position: fixed, sites will try to use position: fixed based on the 
support for opacity! I realise this is a slightly extreme example (or is 
it? sounds like IE), but I think it illustrates my point. Maybe the 
availability of text-shadow on browsers such as Safari which is in other 
respects less advanced than Mozilla is a better example.

In this light, I think e.g. something to express that *all* properties 
inside must be supported (instead of just one of them) might be a better 
idea. An @-rule like @require-property-support {} sounds alright.

Problem with this is that if you want to use e.g. browser-specific CSS 
to solve certain issues, it needs to be excluded from the group somehow. 
Because such a single rule would make the block not be applied on all 
other browsers as they do not support it, yet it would need to be part 
of the group because it depends on the condition.

Take the following example, where I only want to use some CSS when it is 
in border-box render model:

@require-all-properties {
    div {
       width: 100px;
       padding: 10px;
    }
    div {
       -mox-box-model: border-box;
       box-model: border-box;
    }
}

How would this work? !exclude? That seems kinda counter-intuitive -_-;;. 
But note how you can’t express this with !required either, as the bottom 
two properties have an OR relationship.

The more I think about it, the more difficult it becomes :). Maybe in 
this light, the ‘require-all’ thing isn’t that much better, or at least 
not trivial to do. But the objection against singling out certain 
properties raised in my second paragraph remains.


~Grauw

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san!!

Received on Monday, 4 April 2005 21:54:00 UTC