Log in   Register a New Account

Accessify Forum - Discuss Website Accessibility

New to the forum?

Only an email address is required.

Register Here

Already registered? Log In

Accessibility, validation and IE CSS hacks

Reply with quote My take is that we all got hard-ons about CSS. Brilliant minds came up with hacks to solve the box model problems etc, and we were all delighted and gratefully legged it back to our computers to implement the hacks (rightfully; I'm not being sarcastic here). We were so down on IE that we didn't remember the little-used conditional comments feature because it smelt of browser-specific code which we regarded as retrograde 90's naughiness.

Now, after sober reflection, we've realised that using a well-document IE-specific feature to serve stuff to IE is better than taking advantage of IE's version-specific parsing errors to serve stuff to it (and then having to write "be nice to Opera" rules which in turn rely on broken implementations of CSS that will be corrected in IE7).

IE cond comments aren't a universal panacea that will get rid of all hacks, but for sending things only to IE (and sub-versions of IE) they're great.

A philosophical arguement against them says that its adding markup pollution to serve styles to browsers. Personally, I feel that css pollution is worse (and stylesheets full of hacks make css look buggy and unmaintainable). But that's philosophy, and it isn't Philosophy Friday today.
Reply with quote
Brett wrote:
JonTan wrote:
Hi Brett

Can I ask, what are in the includes? I.e: /header.inc and /left_home.inc? Do they contain a site map or skip content link or a search facility? One thing strikes me is that regardless of the accessibility of invalid CSS, if a user has to go through the whole page to reach the menu or orther site navigation options that might prove problematic.


Hi Jon,

Yes, the left_home.inc does contain both a searchfacility and a 'skip to content' link to enable users to get to the juicy bits of the site!

Brett


A resonable level of accessibility will be served then IMO.

I agree that conditional comments, implemented as Bruce suggests is the best way to insert your browser specific workarounds. At least then, if you decide to not support a given browser or simply have the footer appear last in the mark-up and visually in IE, without a fixed position you can remove the extras.

I'm no CSS purist but I agree with Bruce too that minimal hacks or workarounds will always be a benefit to longer-term managability. I often find it easier to try and talk a client out of some design requests that might require a hack or extraneous code. Its common sense and most listen (touch wood).

A useful reference might be this comprehensive CSS Filters resource.
Reply with quote What I don't like about conditional comments is, that I have to maintain a style sheet more and that it doesn't work having multiple IEs installed. But this does not stop me using conditional comments. It always depends on how many hacks would be necessary. If it's only one or two, I tend to use css hacks, always hoping that I won't have to change all style sheets when IE7 is out...

creisi
Reply with quote Creisi that's an excellent point about testing - about a month ago I was having a nightmare with my cod. comments because I couldn't figure out why they weren't working. Then I looked it up and only then found that they don't work if you've multiple versions of IE installed.

Alex
Reply with quote There's a fix for that! Smile

Simon Pieters
Reply with quote Thank you Simon, this is making me happy Smile

creisi
Reply with quote Thought I'd completely immodestly point out an article I've written on cleaning yoiur css hacks using conditional comments http://www.brucelawson.co.uk/index.php/2005/future-proof-your-css-with-conditional-comments/

'scuse the self-link
Reply with quote Because it means adding that extra lump of markup to every page of your side, when a CSS hack only means adding a little code to your CSS file. However, invalid CSS is a device accessibility issue. By using invalid CSS, you run the risk of untested user agents producing garbled pages to any visitor who uses them. It's the same thing as using invalid markup; it increases the risk of the pages becoming inaccessible or incomprehensible to the end user, imho.

I have to admit that I'm guilty of CSS hacks, but never any which make my CSS invalid. The use of hacks is a dubious practise though, since it runs the risk of sending incorrect CSS intended for IE to other devices which might not respond as expected.


The solution to non-standard user agents is to use standard code which will degrade gracefully, rather than creating non-standard code in the hope it filters through to all devices as you want. Conditional comments at least allow non-standard code to be direct at IE without the risk of screwing up other user agents but proprietary code should normally be avoided, since the Web is not owned by any particular company.

Display posts from previous:   

Page 2 of 2

Goto page Previous  1, 2

All times are GMT

  • Reply to topic
  • Post new topic