wyc
wyc

Reputation: 55273

Are there some good CSS practices in order to avoid browser-compatibility issues with IE?

I've discover so far that:

Do you know any others?

Upvotes: 1

Views: 122

Answers (2)

x1a4
x1a4

Reputation: 19485

  • Learn about hasLayout

  • Inline block behavior can be achieved on IE7 by turning on hasLayout, then setting display to inline. This has turned out to be quite useful to me.

  • Make sure your doctype is present and correct. This alone can save hours of pain.

  • Use conditional comments anytime you need to hack something especially for IE. PLEASE don't fall into the amateur's habit of adding star/underscore junk in your main stylesheet.

Upvotes: 2

David Hedlund
David Hedlund

Reputation: 129792

I'd say that manually setting width would more often than not break things in IE, as a lot of IE versions implement a flawed box model.

I'd also say that a lot of all browser incompatibilities originate from a sub par understanding of the box model and float/clear, block/inline.

Having said that, I of course do not deny that it is IE, rather than the developer, that is the real problem, but I usually seek to avoid browser incompatibilities by using HTML structures that not even IE could miss-interpret, rather than through CSS hacks, and I've found that that is often quite doable.

Upvotes: 1

Related Questions