如何得到奇怪/甚至着色的IE和Firefox使用CSS单独? [英] How to get odd/even coloring for IE and Firefox using CSS alone?

查看:76
本文介绍了如何得到奇怪/甚至着色的IE和Firefox使用CSS单独?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



因此,我需要在Firefox和互联网浏览器中使用的代码。

我使用php为我的web项目, p>

此代码已写入,但无法在Internet Explorer中使用:

  .tbl_css col:nth-​​child(odd){
}

.tbl_css col:nth-​​child(even){
}


解决方案

低版本的IE不支持伪选择。



您可以使用jQuery使其工作:

  $(document).ready(function(){
$('table tr:even')。addClass('even');
$('table tr:odd')addClass('odd');
}

在CSS中:

  .even {/ * your styles * /} 
.odd {/ * your styles * /}


I use php for my web project, but I need this coloring complement with CSS alone.

Thus I need code that works in Firefox and internet explorer.

This code is written, but does not work in internet explorer:

.tbl_css col:nth-child(odd){      
}

.tbl_css col:nth-child(even){    
}

解决方案

Lower versions of IE will not support pseudo-selection.

You can use jQuery to make it work:

$(document).ready(function(){
    $('table tr:even').addClass('even');
    $('table tr:odd').addClass('odd');
});

In CSS simply:

.even{ /* your styles */ }
.odd { /* your styles */ }

这篇关于如何得到奇怪/甚至着色的IE和Firefox使用CSS单独?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆