@try in CSS3 (was: Useragent Rules in CSS)

Christoph Paper:
> Like already proposed, the minimal solution was a grouping at-rule, like
>
> @batch {
>    foo {property1: value; property2: value}
> }
>
> If the browser can apply *all* rulesets inside, they are, else none of them.

First of all, I realize what this syntax is now - it's essentially multiple try
blocks.


> Can anyone provide an example which this approach cannot solve?

Sadly, I can:

@try {
 #myDiv {
  width: 100px;
  margin: 1px;
 }
}

Internet Explorer would incorrectly draw the block 98px wide, even though it
technically supports all that's in the @try. However - it's better than nothing.
If I take IE's total profile into account I can lock it out nicely:

@try {
 body>#myDiv {
  width: 100px;
  margin: 1px;
 }
}
@catch {
 #myDiv {
  width: 102px;
  margin: 1px;
 }
}

I like this idea.

-Chris "SoopahMan" Moschini
http://hiveminds.info/
http://soopahman.com/

Received on Wednesday, 31 March 2004 10:34:44 UTC