Welcome to WebmasterWorld Guest from 54.198.205.153

Forum Moderators: not2easy

Message Too Old, No Replies

How to target IE/Mac only

Finally, a solution!

     
12:26 am on Jan 11, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


The Double Hack


Problem:
How to target only IE/Mac with a style sheet, but leave all other browsers unaffected?

Description:
IE/Mac's CSS engine is way better than IE/Win. But, there are times when a few minor changes are required to cause it to render a page correctly. However, these fixes/changes sometimes causes the page to break in other browsers. Until recently, there was no solution that could target IE/Mac only AND validate. Until now...

Solution:

<style type="text/css">
\/*
@import("stylesheet.css");
*/
</style>

It's a variant of the commented backslash hack. Except, in this case, the backslash is used to hide the comment from IE/Mac. Only IE/Mac will load the style sheet. And, it validates! :)

The import rule itself is only recognized by IE/Mac. But, it doesn't validate. So, another hack must be used to hide the import rule from the validator (and all other browsers) but still let IE/Mac through. Thus, the hack is now officially named "The Double Hack".

6:05 am on Jan 11, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


DrDoc, you blew me away with that one. Can't wait to try it.

I often feel bad for the way I treat Mac IE visitors, but I know they are "used to it". Nevertheless, you've apparently come up with something a lot more important than getting NN4 to behave!

1:29 pm on Jan 11, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Oct 1, 2002
posts:5199
votes: 0


WTG DrDoc!

this should prove very handy especially as I just been doing battle with IE5/Mac too...

Suzy

2:14 pm on Jan 11, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 24, 2003
posts:12
votes: 0


That's very helpful Doc. Thanks a lot!
5:49 pm on Jan 12, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


Already it has proved helpful. I was able to fix an IE/Mac problem on one of my sites ;)
And, it allows for cleaner code. No more commented backslash hacks in the middle of everything!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members