Hi, I‘m Matthew Ausonio. I am a web developer currently working in downtown San Diego. I also sometimes toy around with designing websites. If you would like to know more, please visit the about page.

Tags

Safari 2 Specific CSS Hack?

possible_hack.gifSo I’m going to get to the point with this post. I was tinkering, and may have found a CSS hack that targets only IE7 and Safari 2.0. You can then of course override the the style with a IE7 specific hack, thus using this technique to target Safari 2.0 alone.

Now, I don’t like the use of hacks, but I am very curious if this works. I know it could probably come in handy to many developers when working with Safari.

I have not yet tested this on Safari 3.0. This is a list of browsers I have tested on:

  • IE6 - Windows 2000
  • IE7 - Windows Vista
  • Firefox 2.0.0.4 - Windows Vista
  • Safari 2.0.4 - OS X
  • Firefox 2.0.0.4 - OS X
  • Opera 9.20 - OS X

As I mentioned before, this hack seems to only target IE7 and Safari 2.0. So lets move on to the code and an example.

/*/*/html*.text_field_wrap>div {display:none;}/* */
*+html .text_field_wrap div {display:block;}

This example will simply tell a div to display in Safari. The second CSS line resets the style for IE7. The ending result will only effect Safari 2.0. To see this CSS example in action, view the sample by clicking here.

So, try it out. And please leave a comment with any findings. Thanks.

Update

I have tested this on Safari 3.0 beta / Windows Vista. And it worked. So maybe I have also found a CSS hack for Safari 3.0. Which could be helpful in the near future.

Please leave comments with your browser information and whether you saw the green or red box. It doesnt matter what browser you have. I just want to gather more info on this. Thanks.

6 Responses

  1. Bryan

    Thanks for the hack

    Keep up the site with some helpful css and html tips…

  2. Jess

    Hey, thanx for this nice little piece of code! i viewed your demo page running IE 6 on Windows XP and saw the read box.

  3. sarah

    it’s green in Netscape 7.0

  4. Anonymous Coward

    Nice! Thanks for that, I noticed though that it will apply the attribute to IE6. So you will have to * html hack whatever your IE7 reset value is.

  5. Chaz

    I thought I had found the answer to my problem, and for safari 2.0 i have (along with a few others), but the hack doesn’t work for safari 3 in windows :(

  6. James

    Works on Safari 3.0.3 for Windows, cheers!

Leave a Reply