Forum Moderators: not2easy

Message Too Old, No Replies

IE driving me mad with CSS

why does it have to do things differently

         

hughie

3:12 pm on Mar 29, 2006 (gmt 0)

10+ Year Member




Is it just me or does IE treat CSS differently to opera/firefox. Everything behaves itself nicely in Firefox but as soon as a take a peak in IE its all gone horribly wrong.

I'm fairly new to total CSS and its getting quite annoying! things like border-spacing:2px and other such commands are adheared to by firefox&opera and ignored by IE.

Is it errors in my code or IE that's to blame?

grrr ;-)
hughie

alias

3:52 pm on Mar 29, 2006 (gmt 0)

10+ Year Member



Like always, it is IE to blame (if we're talking IE6 here). It does support css1, but that support is fairly poor. Learn how to use css hacks. And just experiment - eventually you'll notice the most issue-causing cases.

evo81

3:54 pm on Mar 29, 2006 (gmt 0)

10+ Year Member



Yeah, it's probably IE. Check your code validates.

Regards

hughie

10:26 pm on Mar 29, 2006 (gmt 0)

10+ Year Member



i'm glad it's not just me going potty, it is enough to drive you mad!

zCat

11:12 pm on Mar 29, 2006 (gmt 0)

10+ Year Member



As someone who puts together websites, but not a webdesigner or CSS guru, IE is the bane of my life...

If you don't know it already, you can do something like this to keep all those nasty IE hacks seperate:

<!--[if IE]><style type="text/css">@import "/ie-hacks.css";</style><![endif]-->

boske3

10:36 am on Apr 4, 2006 (gmt 0)

10+ Year Member



zCat you wrote:
<!--[if IE]><style type="text/css">@import "/ie-hacks.css";</style><![endif]-->

What does it mean?Sorry i am new in CSS and have also problems with IE6 and CSS.
That IE6 doesn't work with CSS well,so i need if this
is some of kind of bypass for IE6?
Thanks

doodlebee

2:13 pm on Apr 4, 2006 (gmt 0)

10+ Year Member



It's a conditional comment. It's recommeneded highly to use *instead of hacks*. Hacks are ugly, and more often than not, browser you *don't* want to render the hack-commands will, and you're stuck with hacks fixing hacks - a complete headache to fix just one browser.

Remember back in the day, when people would use javascript sniffers to determine what browser the end-user was using, and serve up the stylesheet for that particular browser? Conditional comments are something like that - except no javascript. See, the thing is, most browsers out there are standards-compliant. So if you code a site for, say Firefox, it'll pretty much look fine in Netscape, Konqueror, Safari, Opera and stuff - because they are all compliant browsers. You *may* have to fudge a few things every now and again, but for the most part, you're okay. IE, however, is in it's own little world. Using a conditional comment simply tells IE to "render the regular stylsheet, and hey, here's some stuff to append that for your sorry ass."

You can see a great article on conditional comments and how to use them at Position Is Everything [positioniseverything.net]. (this link also show your how to use IE standalones to test in multiple versions of IE - scroll down a bit to see the conditional comments stuff.) But you can easily create a stylesheet for compliant browsers, and then create a separate, "appendage" stylesheet for IE...no need to completely rewrite the stylesheet - just target those specifics that need fudging for IE, and you're set.