jQuery :nth-last-of-type() 选择器

jQuery 教程 · 2019-03-10 09:26:59

实例

选取属于其父元素的第三个 <p> 元素的每个 <p> 元素,从最后一个子元素开始计数:

$("p:nth-last-of-type(3)")

定义和用法

:nth-last-of-type(n) 选择器选取属于其父元素的特定类型的第 n 个子元素的所有元素,从最后一个子元素开始计数。

提示:请使用 :nth-last-child() 选择器来选取属于其父元素的不限类型的第 n 个子元素的所有元素,从最后一个子元素开始计数。

语法

:nth-last-of-type(n|even|odd|formula)

参数 描述
n 要匹配的每个子元素的索引。

必须是一个数字。第一个元素的索引号是 1。
even 选取每个偶数子元素。
odd 选取每个奇数子元素。
formula 规定哪个子元素需通过公式 (an + b) 来选取。 实例:p:nth-last-child(3n+2) 选取每个第三段,从倒数第二段开始。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Computer Age Statistical Inference

Computer Age Statistical Inference

Bradley Efron、Trevor Hastie / Cambridge University Press / 2016-7-21 / USD 74.99

The twenty-first century has seen a breathtaking expansion of statistical methodology, both in scope and in influence. 'Big data', 'data science', and 'machine learning' have become familiar terms in ......一起来看看 《Computer Age Statistical Inference》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具