Jag fick informationen via ett nyhetsbrev. Citerar det nedan:
Citat:
IE'S A'COMING! BATTEN DOWN THE HATCHES! - - - - - - - - - - - - -
The winds are building steadily and the clouds look ominous.
What is this looming danger? Its name is IE7 and it's sweeping
down from Seattle looking to overturn unsuspecting and
unprepared Websites.
If you've been happy to build your sites in 'quirks mode' (with
all the attendant quirkiness) you shouldn't see too much
difference in IE7. However, if you've been coding strict and
using a good helping of nifty CSS hacks, your chickens may well
be coming home to roost.
As reported on IE Blog [1] last month, IE7 will now understand
many of the hacks it used to ignore, without necessarily
changing from the way IE6 used to render them.
In particular, the hacks that we know, for certain, will no
longer work are:
- The HTML Child Hack
html > body [2]
- The Star Hack (or Universal Selector Hack)
* html [3] [4]
- The Owen Hack
head:first-child + body [5]
- The Adjacent BODY Hack
head + body [6]
- The BODY Child Hack
body > element [7]
The second of these is a rule that IE6 understands and all other
browsers correctly ignore -- the HTML element should never have a
parent -- while the other rules are perfectly valid CSS that was
never understood by IE. In all cases, IE7 now conforms with the
other browsers. In reality, I suspect only #2 and #5 are widely
used.
So, how do you defend yourself from the vagaries of IE rendering
now? The answer is Conditional Comments [8].
If you haven't used them before, don't worry: they're not
difficult to understand. Check out this snippet.
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="/ie-fix.css />
<![endif]-->
All non-Microsoft browsers will see the above markup as nothing
more than a comment, and as such, they'll ignore it completely.
IE has the ability to parse the comment and look for the
telltale square bracket instructions. There have been some, in
my opinion, misguided calls from developers to ignore
conditional comments as a proprietary Microsoft irrelevancy.
Don't listen.
Of course, this is only the simplest form of conditional
comments. They can also allow you to craft more intricately
targeted content.
- <!--[if IE6]> : allows you target a specific browser version
- <!--[if gt IE 5]> : allows you to target all versions after
the one you specify
- <!--[if lt IE 5]> : allows you to target all versions before
the one you specify
- <!--[if gte IE7]> : allows you target all versions after and
including the one that you specify
- <!--[if lte IE6]> : allows you target all versions before and
including the one that you specify
This is a relatively elegant, standards-compliant and, more
importantly, future-proof solution that should become your CSS
mainstay -- if it isn't already. Of course, if you were clever
enough to code without using hacks in the first place, take a
bow ... and the rest of the day off. Otherwise, now is a really
good time to start sifting through your old sites for rogue
hacks -- before the storm really breaks.
|