WN

WN (https://www.wn.se/forum/index.php)
-   Klientsidans teknologier, design och grafik (https://www.wn.se/forum/forumdisplay.php?f=12)
-   -   MSIE7s julklapp till frustrerade webbutvecklare (https://www.wn.se/forum/showthread.php?t=10776)

guran 2005-11-09 07:37

Nu är Microsoft på gång med att försvåra ytterligare för webbutvecklar som vill kunna koda med CSS på ett korrekt sätt. Deras nya version 7 av IE har lärt sig flera s.k. CSS-hack, dvs. de kommer inte längre att fungera i IE7 och detta utan att Microsft har brytt sig om att korrigera de buggar eller de felaktiga implementeringarna av W3Cs CCS-regler som hacken är avsedda att korrigera.

Livet är hårt för en liten webbutvecklare. Känner någon till något hjärntvättningsprogram där jag kan lära mig att älska Microsoft okritiskt och förkasta resten av mjukvarumarknaden?

zpD 2005-11-09 07:45

Du har ingen länk till artikel om detta?

Henrik N 2005-11-09 17:47

Jag antar att det handlar om CSS-parsningsfel och liknande som de rättat. Det är väl bara att använda conditional comments istället?

guran 2005-11-09 18:10

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.



Alla tider är GMT +2. Klockan är nu 01:22.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson