mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-08 12:04:29 -05:00
Translated descriptions (#21535)
This commit is contained in:
committed by
Jingyi Ding
parent
378e346077
commit
466e82c930
@@ -1,27 +1,30 @@
|
||||
---
|
||||
title: CSS3 Nth Child Selector
|
||||
localeTitle: CSS3 Nth Child Selector
|
||||
localeTitle: CSS3 第`nth-child`选择器
|
||||
---
|
||||
## CSS3 Nth Child Selector
|
||||
## CSS3 第`nth-child`选择器
|
||||
|
||||
第`nth-child`选择器是一个css伪类,它采用一种模式来匹配一个或多个元素相对于它们在兄弟姐妹中的位置。
|
||||
|
||||
## 句法
|
||||
|
||||
|
||||
```CSS
|
||||
a:nth-child(pattern){
|
||||
/* Css到这里 */
|
||||
}
|
||||
```
|
||||
### Pattern
|
||||
|
||||
The patterns accepted by `nth-child` can come in the form of keywords or an equation of the form An+B.
|
||||
|
||||
#### Keywords
|
||||
### 模式
|
||||
|
||||
第`nth-child`所接受的模式可以是关键字或An+B的方程
|
||||
|
||||
#### 关键字
|
||||
|
||||
##### Odd
|
||||
|
||||
Odd returns all odd elements of a given type.
|
||||
|
||||
`Odd`会返回所属于特定类型的HTML元素当中的奇数元素。
|
||||
在下面的示例中,所奇数的`a`元素将会被指定,而选择器中的CSS会被插入被指定的元素中。
|
||||
|
||||
```CSS
|
||||
a:nth-child(odd){
|
||||
@@ -31,7 +34,10 @@ localeTitle: CSS3 Nth Child Selector
|
||||
```
|
||||
##### Even
|
||||
|
||||
Even returns all even elements of a given type.
|
||||
|
||||
`Even`会返回所属于特定类型的HTML元素当中的偶数元素。
|
||||
在下面的示例中,所位于偶数的`a`元素将会被指定,而选择器中的CSS会被插入被指定的元素中。
|
||||
|
||||
|
||||
```CSS
|
||||
a:nth-child(even){
|
||||
@@ -40,10 +46,11 @@ localeTitle: CSS3 Nth Child Selector
|
||||
|
||||
```
|
||||
#### An+B
|
||||
|
||||
`An+B`会返回所有属于特定类型的HTML元素中,符合An+B(n与每个正整数)的元素
|
||||
在下面的示例中,每隔三个`a`元素的元素将会被指定,而选择器中的CSS会被插入被指定的元素中。
|
||||
|
||||
Returns all elements matching the equation An+B for every positive integer value of n (in addition to 0).
|
||||
|
||||
For example, the following will match every 3rd anchor element:
|
||||
|
||||
```CSS
|
||||
a:nth-child(3n){
|
||||
/* CSS在这里 */
|
||||
|
||||
Reference in New Issue
Block a user