How to do a Chrome/Opera specific stylesheet?

前端 未结 6 644
野性不改
野性不改 2020-12-07 23:26

I need to do chrome/opera hacks because of a font replacement script wanted by the client that breaks things... this is sad but everything is working in IE6

6条回答
  •  时光取名叫无心
    2020-12-07 23:40

    Just remember that : "User-Agent sniffing is baaaffffd"

    That's not and will never be a good practice.

    It's just pain in the ass to maintain a website where User-Agent sniffing is implemented.

    You should prefer separated stylesheets, or css hacks if they're in low quantity or if you don't have time to make multiple stylesheets.

    For Opera you can use this trick :

    @media all and (-webkit-min-device-pixel-ratio:10000),
        not all and (-webkit-min-device-pixel-ratio:0) { 
         #id {
             css rule;
         }
     }
    

    And Sadly, every Chrome css hacks are also applyed to Safari.

    There's no way to separate the 2 renderings excepted for the old versions of Safari (<= safari3 if I remember well)

提交回复
热议问题