IE6、IE7不支持 first-child 属性
2013-12-25 17:49
573 查看
原文地址:http://www.aoao.org.cn/blog/2007/03/first-child/
IE6、IE7不支持 first-child 属性,不过可以用其他办法替代。
代码解析
*border-top-style:expression(this.previousSibling==null?’none’:"solid’);
只有IE6和IE7能识别此行代码,第一个值’none’就是first-child的值,第二个值’solid’则是其他元素的值。
last-child原理相同,代码如下
现在,IE6和IE7是不是相当于实现了first-child的功能了,CSS就是那么强大!
IE6、IE7不支持 first-child 属性,不过可以用其他办法替代。
#sidebar li:first-child{ border-top-style:none; } #sidebar li{ border-top-width:1px; border-top-style:solid; border-color:#DAD3D0; *border-top-style:expression(this.previousSibling==null?"none":"solid"); }
代码解析
*border-top-style:expression(this.previousSibling==null?’none’:"solid’);
只有IE6和IE7能识别此行代码,第一个值’none’就是first-child的值,第二个值’solid’则是其他元素的值。
last-child原理相同,代码如下
#sidebar li:last-child{ border-bottom-style:none; } #sidebar li{ border-bottom-width:1px; border-bottom-style:solid; border-color:#DAD3D0; *border-bottom-style:expression(this.nextSibling==null?"none":"solid"); }
现在,IE6和IE7是不是相当于实现了first-child的功能了,CSS就是那么强大!
相关文章推荐
- 让IE6、IE7、IE8 支持CSS 3圆角属性的方法(转)
- 让IE6IE7IE8支持CSS3属性的8种方法介绍
- 让ie6,ie7,ie8支持 css3 的部分属性实现全兼容
- :first-child :last-child IE5,IE6,IE7,IE8的css兼容性列表
- IE6,IE7不支持的十个CSS属性
- IE6、IE7中setAttribute不支持class/for/rowspan/colspan等属性
- 解决position: fixed;不兼容IE7的问题,由于IE6不支持些属性,可以不管
- 纯CSS制作支持IE6、IE7、Firefox的下拉菜单
- bootstrap支持ie8 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- 针对ie6 用层来实现select的title 提示属性 (增加含有滚动条情况的支持)
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- 纯CSS的下拉菜单 支持IE6 IE7 Firefox
- 纯CSS的下拉菜单 支持IE6 IE7 Firefox
- 让IE6、IE7、IE8支持CSS3的圆角、阴影样式
- 【实用随记】ie下不支持first-child,last-child
- 网页PNG透明支持(IE6、IE7、firefox下测试通过
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- IE6,IE7和firefox对DIV的支持区别