JohnnyCoin

博客园 首页 新随笔 联系 订阅 管理

:first  $("p:first")  第一个p元素,很好理解

:last  $("p:last")  最后一个p元素

:even  $("tr:even")  所有的偶数<tr>元素

:odd  $("tr:odd")  所有的奇数<tr>元素

<<-------------------------------------------------------------------------------->>

:first-child  $("p:first-child")  属于其父元素的第一个子元素的所有<p>元素,这个<p>元素必须是第一个!

:first-of-type  $("p:first-of-type")  属于其父元素的第一个<p>元素的所有<p>元素,也就是说这个<p>元素相对其他类型的元素可以不是排第一的,但必须是在其同辈的<p>元素中排行第一!

:last-child  $("p:last-child")  同:first-child相反

:last-of-type  $("p:last-of-type")  同:first-of-type相反

<<-------------------------------------------------------------------------------->>

:nth-child(n)  $("p:nth-child(3)")  属于其父元素的第n个子元素的所有<p>元素,这个<p>元素必须是第n个!

:nth-last-child(n)  $("p:nth-last-child(3)")   和上相反

:nth-of-type(n)  $("p:nth-of-type(3)") 同first-of-type相似

:nth-last-of-type(n)  $("p:nth-last-of-type(3)")  和上相反

<<-------------------------------------------------------------------------------->>

:only-child  $("p:only-child")  属于其父元素中唯一的<p>元素,只有一个元素,并且这个元素是<p>元素

:only-of-type  $("p:only-of-type")   属于其父元素中特定类型的唯一子元素的所有<p>元素,就是说,只要这个父类元素中,只有一个<p>元素,有多少个其他类型的元素都可以。

posted on 2016-04-15 15:48  JohnnyCoin  阅读(114)  评论(0)    收藏  举报