zoukankan      html  css  js  c++  java
  • nth-child(n)后代选择器IE8不兼容问题

    使用jQuery解决方案:

    if (navigator.appName === 'Microsoft Internet Explorer') { //判断是否是IE浏览器 
      if(navigator.userAgent.match(/Trident/i)&&navigator.userAgent.match(/MSIE 8.0/i)) {
        $('p:nth-child(2)').css('color','blue');
        //$('p:nth-of-type(2)').css('color','blue');
      }
    }

    第二种方法:

    div p:first-child  {color:red} 给第一个加颜色
    div p:first-child+p  { color:blue; } 给第二个加颜色 
    div p:first-child+p+p  { color:yellow; } 给第三个加颜色
  • 相关阅读:
    day 38
    day 37
    day 36
    day 35
    day 34
    day 33
    day 32
    day 31
    day 30
    day 29
  • 原文地址:https://www.cnblogs.com/surplus/p/15154779.html
Copyright © 2011-2022 走看看