[thelist] IE CSS Troubles...surprise...surprise...

Andrew Clover and-evolt at doxdesk.com
Fri Jul 8 18:27:10 CDT 2005

Tanner Burson <tanner.burson at gmail.com> wrote:

> I've begun development of a simple XHTML 1.1 / CSS
> standards compliant site.

You might want to reconsider using XHTML 1.1. For general web site 
purposes there is little current benefit over XHTML 1.0 Strict, and it 
brings a few things that might trip you up.

The standard in particular says you should serve it as MIME type 
application/xhtml+xml, *not* text/html. XHTML 1.0 is slightly more 
lenient on this matter.

If you are aware of the issues 'real XML mode' brings with it you could 
serve it with a server-side Accept-sniffer to allow for IE. Just putting 
the XML MIME type in a <meta> *does not* trigger XML parsing - for one, 
because the browser would have to decide which way to parse elements 
before it gets to the <meta> element. Mozilla et all will still parse 
this as legacy HTML which is what your server is saying it is.

XHTML 1.1 is an interesting thing for standards junkies to play with, 
and is the basis for various mobile standards, but there's little need 
to use it for general websites at the moment IMO, and nobody really is.

> fails terribly in IE.

It doesn't look so bad, but looking at the CSS you're using a lot of 
child selectors ('>') which are never going to work on IE. The adjacent 
selector '+' isn't supported either. Neither is the 'min-height' 
property, and numeric font-weights are generally best avoided - they are 
buggy in some browsers and even in those where they work you don't get 
any more control over weight than simple 'bold'/'normal'. (This is 
typically because OS font managers are too dumb to know about any other 
weight relations between fonts.)

The other layout differences are likely caused by IE misinterpretation 
of the top and bottom margin collapsing rules (which are admittedly 
bizarre to start with even before IE mangles them). You could try to 
avoid leaving spare margin at the top and bottom of formatted blocks, to 
stop IE getting it wrong, or just generally use padding instead of 
vertical margins where possible.

Andrew Clover
mailto:and at doxdesk.com

More information about the thelist mailing list