使用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; } 给第三个加颜色

 

相关文章:

  • 2022-12-23
  • 2021-06-06
  • 2021-11-03
  • 2021-10-27
  • 2022-12-23
  • 2021-10-12
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案