User Defines Style sheets and Quirks mode | September 23, 2003

I've been trying to create an accessible user style sheet based on the default style of the BBC's Betsie program. I thought this would be an easy task but it's actually been proving quite tricky.

What I want to be able to do is linearize a table based layout. To do this I've been using:

table, tr, td {
  display: block !important;

However when I tested this on a number of popular sites like Yahoo or Amazon, the layout didn't get linearized at all. In fact it ended up getting severally mangled. It turns out that these popular sites don't have a doctype. This sends my browser into quirks mode and turns the layout to jelly when viewed using my custom style sheet.

The idea behind user style sheets is to give final control to the user. Unfortunately this breaks down if the browser/site has final say about the rendering mode. With so few sites actually having doctypes, this makes creating useful user style sheets a real hurdle.

The only way I can see round this is for browser manufactures to allow people to alter the rendering mode themselves (does any browser currently do this?). Otherwise user preferences are always going to be held over a barrel by web browsers and doctype-less sites.

Posted at September 23, 2003 7:57 PM


Jeff Croft said on September 24, 2003 4:31 PM

I don’t believe any browser currently does this, but I would LOVE it if it did. Then, each person who chose to put his browser into standards mode would rightfully be able to bitch at all these companies who have sites that don’t have DOCTYPES. Enough bitching might change things. Who knows. :)

Andy Smith said on September 26, 2003 4:38 PM

It wouldn’t surprise me if you can access/change the rendering mode through JavaScript so maybe it would be possible to do it with a bookmarklet. But the way to do it would probably vary from browser to browser.

What would be handy here would be to be able to run a bookmarklet automatically every time a new page loads. Actually this would be good with other bookmarklets as well. Anyone know if this is possible in any browsers? I suspect it can be done in Mozilla at least because so much of the UI is scriptable XUL, but I wouldn’t know how to actually do it.

Come to think of it I think I remember seeing that Mozilla does its quirks mode with style sheets anyway… [looks around] well, there is a file called quirk.css that implements at least some of the quirks, so this should all be overridable assuming it doesn’t take precedence over the user style sheet. But I guess some of the quirks might be done in the rendering code if they can’t be expressed as CSS rules, even using extensions like -moz-box-sizing.

Barry said on January 7, 2004 8:10 AM

Thank you for opening a wonderfully new sight..I wish you the best of luck with your new venture.