freeCodeCamp/guide/russian/css/css3-nth-child-selector/index.md

1.6 KiB

title localeTitle
CSS3 Nth Child Selector CSS3 N-й детский селектор

CSS3 Nth Child селектор

Селектор nth-child - это превдокласс, находит один или более элементов, основываясь на их позиции среди группы соседних элементов.

Синтаксис

`` `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 
 
 ##### Odd 
 
 Odd returns all odd elements of a given type. 

CSS a: nth-childe (нечетный) { / * CSS идет здесь * / }

##### Even 
 
 Even returns all even elements of a given type. 

CSS a: nth-childe (even) { / * CSS идет здесь * / }

#### An+B 
 
 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-childe (3n) { / * CSS идет здесь * / } `` `

Дополнительная информация:

Документация MDN CSS-трюки - n-й дочерний селектор CSS Tricks - n-й детский тестер W3Scools - n-й дочерний селектор