Is there a way to do browser specific conditional CSS inside a *.css file?

前端 未结 8 2075
借酒劲吻你
借酒劲吻你 2020-12-11 15:13

Is there a way to do browser specific conditional CSS inside a *.css file? I want to define all of the styles inside of the same physical file.

8条回答
  •  自闭症患者
    2020-12-11 15:43

    you can use this clever javascript file, CSS Browser Selector: http://rafael.adm.br/css_browser_selector/

    it allows you to target specific browsers by using class names such as:

    .ie .example {
      background-color: yellow
    }
    .ie7 .example {
      background-color: orange
    }
    .gecko .example {
      background-color: gray
    }
    .win.gecko .example {
      background-color: red
    }
    .linux.gecko .example {
      background-color: pink
    }
    .opera .example {
      background-color: green
    }
    .konqueror .example {
      background-color: blue
    }
    .webkit .example {
      background-color: black
    }
    

提交回复
热议问题