Forum Moderators: not2easy

Message Too Old, No Replies

Compiler envy - should CSS be simpler?

         

DoctorJ

11:04 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Dear all,

Historically, I have been a programmer. Generally different compilers behave in a uniform and predictable way and, due to language constraints, there is usually only one way to skin the one cat.

Over the last couple of weeks I have played with browser quirks, and toyed with the layout features of CSS. I appreciate that a major feature of CSS is its flexibility to the point where a web developer can do just about anything that can be imagined, e.g. zen garden [csszengarden.com]. However, my observation is that this flexibility is a two-edge sword. Consequently, there appears to be lots of cats and lots of ways to skin them.

Programmers are very competant at shooting themselves in the foot and I believe that it is this that has made "Design Patterns" so attractive. To make advanced CSS more accessible and therefore more popular, should the web developer community embrace design patterns more than has been in the past [css-discuss.incutio.com]. In the same vein, I believe "hack patterns" should be catalogued and the community should promote awareness of them in a more concise way that is currently available. Hacks may be with us for the forseeable future [news.zdnet.com].

To quote the GoF, "A designer who is familiar with such patterns can apply them immediately to design problems without having to rediscover them". This seems like a good thing, no?

DrJ

jetboy_70

11:23 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Compilers may be predictable now, but at the risk of showing my age ... when I started coding it was on a Commodore Pet. I could write Basic on a Pet, but there were some bits that wouldn't work on a Commodore Vic 20, and even more differences between the CBM machines, Apple IIs and ZX81s. And that was just Basic. 6502 and Z80 Assembler were completely different animals! Getting my code to work cross-browser is child's play in comparison. ;)

DoctorJ

11:38 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Hi jetboy_70,

You'll note I used the "Generally" qualifier above. Thanks for making sure people noticed.

I remember writing my first program on an Apple IIe so maybe we are both chronologically challenged ... I hope the "70" isn't your age ;)

DrJ

jetboy_70

11:58 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



No, the 70 is a reference to the level my IQ drops to when I'm this tired. ;)

There are sites that have catalogued hacks - Centricle and Dithered for example. But surely if we raise awareness of them then people would be encouraged to use them? Surely it'd be better to show how it's possible to code without hacks?

DoctorJ

12:05 am on Nov 19, 2004 (gmt 0)

10+ Year Member



Are you suggesting that there is hope for my purist tendencies - if so then I am all "ears".

I started this thread because SuzyUK advocated the use of expressions under IE to get around its lack of support for right and bottom when top and left have been defined for position:absolute. My conclusion was therefore that hacks like this will be part of the CSS landscape for some time.

jetboy_70

12:23 am on Nov 19, 2004 (gmt 0)

10+ Year Member



I wouldn't consider using an expression a hack. However, it is IE-specific code and not strictly CSS, so should be hidden away inside a conditional comment as Suzy suggests.

I'd define a CSS hack as something that exploits a bug or weakness in a browser. Therefore expressions, conditional comments and extra elements for styling purposes are not hacks in my book, they're more like ... workarounds ;)

DoctorJ

12:39 am on Nov 19, 2004 (gmt 0)

10+ Year Member



... whereas the purist considers that the standard is gospel and all proprietary "workarounds" are heresy.

Given your distinction, it comes back to my comment about multiple cats and multiple ways to skin them. I only came across "expressions" recently which points to them either being an embarrassment to CSSers or (optimistically) something that is needed so rarely that they don't rate a mention.

I guess what I am really after is a standard list of the tech required to create good web design and when to use it. This is what a pattern is: a solution to a problem in a specific context.

SuzyUK

8:43 am on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DrJ..

I just replied to another post and I see that it's more relevant here, so: .

moved from in this thread [webmasterworld.com]


I am a bit of a purist so I didn't warm to the idea of using expressions. However, because YOU have said I should .. well that's a different story.

Why, thank you, and outta respect for that opinion let me clarify my reasoning for you..

I don't really warm to the idea to the idea of expressions either, I'd much rather we could follow one CSS standard.. but MSIE have their own standard and that's just the way it is, so the choice is either to use it (their standard) for them or to forgo a lot of CSS usage.

IE Expressions (AFAIK) require that javascript is turned on for them to work which is considered by some purists to be a downside. But the way I see it, IE is the majority browser and it's not easy as a joe bloggs surfer to figure out to turn off JS (not being a regular IE user I had to search to find some instructions ;)) So I would think it's a very, very low percentage and they would be missing out on some other effects too.. (the CSS hover files/scripts used for DropDowns for example).

Other browsers won't even read an expression, but putting it in a conditional comment [msdn.microsoft.com] keeps all IE's CSS seperate and still plays by their rules without polluting the "purist" in me...

I would like not to have to use any "workarounds" at all, but if M$/IE have implemented their CSS one way and most users still use IE then I can and will write the required CSS for them, I might not like it but it's their browser rules and my job, and just because I would prefer to follow one standard I can't just stamp my feet and refuse to do it any other way.. I will still write compliant/valid CSS and will put IE's stuff in their own conditional comments (their get out clause) I might not like it but I can play both ways and keep them seperate..

Just thought I would make this clear so I'm not misleading you or anyone else .. we talk so much about "hacks and bugs" that it's hard to differentiate that it's not always a bug and it doesn't always require a hack..

So basically, the way I see it: I don't see either an expression or a conditional comment as a "hack", just IE's Rules and definitely something to be aware off rather using extraneous HTML elements.. or unneccesary CSS hacks :)

Suzy

I see I have said the same as Jetboy.. honest I didn't see that first ;)

and in answer to what you're now saying here I say there is two standards but we have a way to use them both..

Suzy

SuzyUK

8:46 am on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I only came across "expressions" recently which points to them either being an embarrassment to CSSers or (optimistically) something that is needed so rarely that they don't rate a mention.

I would say it's because the "purists" just don't want to have to use them and not so much an embarrassment but a stance against IE?

To me it's like any code, you use what you have available to you.. admittedly with an expression the JS required bit is a factor in a decision too, depends on the job really

Suzy

[edit: spelling]

[edited by: SuzyUK at 11:09 am (utc) on Nov. 19, 2004]

kiwibrit

10:58 am on Nov 19, 2004 (gmt 0)

10+ Year Member



My site is the company's. There is no question that IE rules - it is what the vast majority of our customers use, and my job is to provide a service to them.

Guilt_Puppy

12:32 pm on Nov 19, 2004 (gmt 0)

10+ Year Member



Coming from a programming background myself, I have to say that browser incompatibilities very much remind me of cross-platform portability issues, including compiler syntax. (I know that compiler syntax should techinically be viewed as separate entirely from platform portability, but in my experience it's only come up in that situation; I've never needed to write code that would compile on two different compilers on the same platform, heh.)

Given that, I have no problem using "hacks", or designating portions of my code as specific to one browser or another... The problem is, unlike C/C++, HTML/CSS does not include a standardized set of conditional directives to work with. Now, fortunately IE (the most widely-used and most non-standard browser) does include such a system, but it isn't useable in every circumstance, nor does it do anything to help workaround third-party bugs/misimplementations. Javascript can generally serve as a more universal (at least among modern browsers) solution, but the programmer in me finds it to be an extremely cumbersome and inelegant solution to what should be, at parse-level, simple. An server-side, inlined language like PHP can solve the problem rather handily; however, it is not available to all designers. And of course, all of this has to occur within your html document, completely circumventing CSS' principle appeal: The ability to create and modify design independent from content.

What's needed isn't complete compliance from every browser (that's just not going to happen, especially if MS maintains its current practices)... What's needed is simply a solid, simple, parse-level pure-CSS conditional structure to sort through browsers and other possible compatibility threats (resolution, for instance)... So long as that gets implemented consistently in the "modern browsers" of the future, the rest can be dealt with without too much headache.

DoctorJ

11:07 pm on Nov 21, 2004 (gmt 0)

10+ Year Member



Well said Guilt_Puppy. While pondering my rant over the weekend I came to the same realisation you mentioned, i.e. cross-browser issues are analagous to multiple platform/compiler issues with compiled languages.

There is of course a down-side to your suggestion: if you provide an "out" for vendors to conform to a standard, they WILL take it. I was recently in a project team where some of the members were influential in the devlopment of a particular ISO standard. In our project, they surprisingly exploited the proprietary loop hole provided by the standard to the exclusion of similiar solutions that were sympathetic to the standard.

So, if you provide an out for browser vendors, will they use the standard? Maybe. Certainly, those vendors whose credibility is based on standards compliance - there is an implicit assumption made by developers (I am the greatest culprit :( ) that all vendors are striving for some open standard utopia. The commercial reality is that a major driver of business is monopoly. The adoption of a standard means that there is less distinction between your product and your competitors. Consequently, if a browser vendor has significant market share, standards compliance becomes a "nice to have" feature unless it has obviously commercial benefit.