CSS3中nth-of-type和nth-last-of-type
来源:互联网 发布:淘宝卖家手续费 编辑:程序博客网 时间:2024/05/22 04:37
1.使用nth-child和nth-last-child时会产生的问题
在使用nth-child和nth-last-child时,其计算子元素是奇数个元素还是第偶数个元素时,是连同父元素中的所有子元素一起计算的。
当父元素是列表时,列表中只可能有列表项目一种子元素,所以不会出问题,但是当父元素是div时,div包含多种子元素,会出现问题。
2.使用nth-of-type和nth-last-of-type
<style type="text/css">
h2:nth-of-type(odd){
background:yellow;
}
h2:nth-of-type(even){
background:blue;
}
</style>
//只计算h2元素的,而不会包含和h2同级别的其他元素
0 0
- CSS3中nth-of-type和nth-last-of-type
- CSS3 :nth-child() ,nth-of-type(),nth-last-child() ,nth-last-of-type()
- 【CSS3】nth-last-of-type(n)选择器
- CSS3中:nth-child和:nth-of-type的区别
- CSS3中:nth-child和:nth-of-type的区别
- nth-last-of-type选择器
- CSS3 :nth-child() 与:nth-of-type()
- CSS3—nth-child()和nth-of-type()
- css3之nth-child和nth-of-type
- css3 :nth-child和:nth-of-type的区别
- 【CSS3】---last-of-type选择器+nth-last-of-type(n)选择器
- css中的first-child nth-child nth-last-child() 和:nth-of-type(n)
- nth-child和nth-of-type区别
- 浅谈:nth-child和:nth-of-type
- :nth-child和:nth-of-type
- CSS3中:nth-child()和nth-of-type()的却别
- css3中nth-child选择器和nth-of-type选择器的区别
- CSS3中:nth-child和:nth-of-type的区别深入理解
- CSS中伪类选择器及伪元素
- 如何将word文档转换成电子书?
- CSS3中结构伪类选择器——root、not、empty、target选择器
- CSS3中first-child、last-child、nth-child、nth-last-child
- java笔记-接口
- CSS3中nth-of-type和nth-last-of-type
- CSS3中only-child伪类选择器
- CSS3使用content属性来插入项目编号
- CSS3让文本自动换行——word-break属性
- CSS3让长单词与URL地址自动换行——word-wrap属性
- CSS3对于盒中容纳不下的内容的显示——overflow属性
- Webservice
- Merge Two Sorted Lists-满满的套路
- 操作系统的简介