Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Структурні та Функціональні Псевдокласи | Бокс Модель та Відстань між Елементами
Основи CSS

bookСтруктурні та Функціональні Псевдокласи

Ці псевдокласи відносяться до позиції елемента в ієрархічній структурі документа.

first-child pseudo-class

The :first-child pseudo-class targets an element that is the first child of its parent, regardless of its tag or class name. Let's consider the following example to clarify. We have a set of elements, and for only the first element (the first <li> element), we want to set its color property to blue.

index.html

index.html

index.css

index.css

copy

Псевдоклас last-child

Псевдоклас :last-child націлений на останній дочірній клас свого батька, дозволяючи нам змінювати будь-які його властивості. Розглянемо приклад, щоб проілюструвати, як можна ефективно використовувати цей псевдоклас.

last-child pseudo-class

The :last-child pseudo-class targets the last child of its parent, allowing us to modify any of its properties. Let's consider an example to illustrate how we can use this pseudo-class effectively.

index.html

index.html

index.css

index.css

copy

nth-child pseudo-class

The :nth-child pseudo-class targets an element based on its position in the hierarchy. It takes an argument in the form of an expression, usually in the form of an+b, which helps determine the specific child elements to select. Let's break down the components of this expression:

  • a represents the loop period;
  • n is the loop counter, starting at 0 and increasing by 1 with each iteration;
  • b is the offset, influencing the starting point of the selection.
index.html

index.html

index.css

index.css

copy

Псевдоклас not()

Псевдоклас :not() вибирає елементи, які не відповідають заданому селектору. Наприклад, :not(p) виділить усі елементи, окрім елементів <p>. Давайте розглянемо кілька прикладів:

not() pseudo-class

The :not() pseudo-class targets elements that do not match a specified selector. For instance, :not(p) would select all elements except for <p> elements. Let's explore some examples:

not() pseudo-class

The :not() pseudo-class targets elements that do not match a specified selector. For instance, :not(p) would select all elements except for <p> elements. Let's explore some examples:

index.html

index.html

index.css

index.css

copy

1. Для чого використовується псевдоклас nth-child?

2. Як працює псевдоклас last-child?

3. How does the last-child pseudo-class work?

question mark

Для чого використовується псевдоклас nth-child?

Select the correct answer

question mark

Як працює псевдоклас last-child?

Select the correct answer

question mark

How does the last-child pseudo-class work?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 5

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

bookСтруктурні та Функціональні Псевдокласи

Ці псевдокласи відносяться до позиції елемента в ієрархічній структурі документа.

first-child pseudo-class

The :first-child pseudo-class targets an element that is the first child of its parent, regardless of its tag or class name. Let's consider the following example to clarify. We have a set of elements, and for only the first element (the first <li> element), we want to set its color property to blue.

index.html

index.html

index.css

index.css

copy

Псевдоклас last-child

Псевдоклас :last-child націлений на останній дочірній клас свого батька, дозволяючи нам змінювати будь-які його властивості. Розглянемо приклад, щоб проілюструвати, як можна ефективно використовувати цей псевдоклас.

last-child pseudo-class

The :last-child pseudo-class targets the last child of its parent, allowing us to modify any of its properties. Let's consider an example to illustrate how we can use this pseudo-class effectively.

index.html

index.html

index.css

index.css

copy

nth-child pseudo-class

The :nth-child pseudo-class targets an element based on its position in the hierarchy. It takes an argument in the form of an expression, usually in the form of an+b, which helps determine the specific child elements to select. Let's break down the components of this expression:

  • a represents the loop period;
  • n is the loop counter, starting at 0 and increasing by 1 with each iteration;
  • b is the offset, influencing the starting point of the selection.
index.html

index.html

index.css

index.css

copy

Псевдоклас not()

Псевдоклас :not() вибирає елементи, які не відповідають заданому селектору. Наприклад, :not(p) виділить усі елементи, окрім елементів <p>. Давайте розглянемо кілька прикладів:

not() pseudo-class

The :not() pseudo-class targets elements that do not match a specified selector. For instance, :not(p) would select all elements except for <p> elements. Let's explore some examples:

not() pseudo-class

The :not() pseudo-class targets elements that do not match a specified selector. For instance, :not(p) would select all elements except for <p> elements. Let's explore some examples:

index.html

index.html

index.css

index.css

copy

1. Для чого використовується псевдоклас nth-child?

2. Як працює псевдоклас last-child?

3. How does the last-child pseudo-class work?

question mark

Для чого використовується псевдоклас nth-child?

Select the correct answer

question mark

Як працює псевдоклас last-child?

Select the correct answer

question mark

How does the last-child pseudo-class work?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 5
some-alt