RE: Proposal of @ua

Brad Kemper wrote:

> On Nov 26, 2007, at 10:52 AM, Alan Gresley wrote:
> > You have often suggested that you need to hack because some browser  
> > doesn't support a CSS3 feature and you need to fix the  
> > nonsupporting browser up. Surely you must be coding for the year  
> > circa 2010 instead of now.
> 
> Not really. I'm coding in a way to best try to realize my designs,  
> and trying not to use deprecated tags, tables for layout, or sliced  
> up images to achieve them. I've given a couple examples of where I've  
> needed hacks. I can give more, if you like, or resend the ones I've  
> already provided.


Six month ago I was using IE CC and at the time I was wishing that the IE had indeed placed the special comments in the CSS.

/* [if IE] */

but indeed they must appear in the html and since IE has a need to see what's inside these CC, so IE7 support of sibling selectors is compromised since the IE engine sees any comment as part of the document tree. CC appeared with IE5 and it is IE5 that begins to fall for the star html hack.

The type of examples that would sway me to support you are test cases showing where some browser is going wrong.


> Some things are easier in Quirks mode, without a 4.01 or XHTML  
> doctype, but I did not have that choice on my current project. Even  
> so, you admitted to using 13 hacks. Does that mean that you are  
> coding for the year 2010?


That happens when I start adding things like this

/* for most browsers */
div#container {
background: url(a);
}

/* for Safari */
div#container {
background: url(b) top left, url(c) bottom right;
}

Most browsers will ignore the later rule block and use the earlier rule block instead. A test case that works in browsers that support multiple background images. I can only check with Safari 3.04 (beta) on windows.

http://css-class.com/test/css/colorsbackgrounds/multiple-backgrounds.htm

This is why I'm wondering about why you are having troubles and with what properties. Since I have used simple cascading to feed Safari a different rule. This test case works in all browsers that I can check on apart from IE5.5. The fix for IE5.5 is just an escape.

/* for Safari */
div#container {
bac\kground: url(b) top left, url(c) bottom right;
}

Now I have my CSS working in all browsers that I can check on.


> My premise is that moving forward there will still be a need for such  
> hacks or filters. That we will never reach the utopian world in   
> which all implementors are supporting all the same rules and all in  
> the same way, and in fact the need will actually grow as new advanced  
> layout methods and such are introduced, and as CSS continues to  
> advance with new properties that are today still in their early  
> stages or as yet undreamed of. But the effects of the "hacks" will be  
> nearly impossible to achieve without explicit support from the  
> implementors for an official way to include.


More reason for test cases. In some way we can help in improving the support of CSS by implementors. I dare say thats where my future lays. Considering that Safari 3..0.4 (beta) on windows passes the acid test 2 and now joining Opera and Gecko 1.9 is said to pass the acid test 2. This is a little milestone of CSS. and for me is an acid test 2 Utopian dream come true.


> >> I also think that the sort of author that would use advanced CSS3 is
> >> more likely to be aware of the issues and write that CSS in a way you
> >> would not object to, and to set a good example for future authors.
> >
> > Would this good example employ the use of a @ua?
> 
> Sort of. Actually, I was suggesting that it be a media query instead,  
> and I gave examples of doing so in a non-exclusionary manner (which  
> is part of what would make it a good example), so that it would only  
> be used where needed to address known issues where a particular  
> rendering engine could not adequately handle the CSS presented to  
> other browsers. In other words, in places where CSS hacks are used  
> today, such as where you used one for IE7.
> 
> So, in theory, if IE8 came out and you still needed the hack but they  
> had fixed the selector bug, then instead of this:
> 
> *:first-child+html a.exlink {display:inline-block;}
> 
> you would be able to apply the same line of code like this (if IE8  
> supported this sort of media query):
> 
> @media screen and (renderer:Trident) {
>   a.exlink {display:inline-block;}
> }


As I have previously inferred IE8 not falling for *:html may only be possible when IE stops supporting CC and that may require a new engine and one which handles my site better. So what known issues need to be addressed that can not be achieved by simple cascading or specificity?

Kind regards, Alan
<http://css-class.com>

Received on Wednesday, 28 November 2007 01:54:30 UTC