# CSS селекторы

Универсальный\
\>>> - **\***\
[Пример.](https://codepen.io/MOgorodnik/pen/xXOeJM)

Селекторы идентификатора и класса (id, class)\
[**#X and .X**](https://codepen.io/MOgorodnik/pen/YrGxvo)

Селектор потомков\
[**X Y**](https://codepen.io/MOgorodnik/pen/BwLdEQ)

Селектор псевдоклассов\
[**X:visited и X:link**](https://codepen.io/MOgorodnik/pen/BwLdXp), **X:checked, X(:first-child / :first-of-type / :nth-child / :target ect.), input:valid/invalid/required.**

Смежный и сестринский селекторы\
[**X + Y, X\~Y**](https://codepen.io/MOgorodnik/pen/ZXpXOq)

Дочерний селектор\
[**X > Y**](https://codepen.io/MOgorodnik/pen/XejegQ)

Селекторы атрибутов\
**X\[href="foo"]** - строгое соответствие\
**X\[href\*="somesing"]** - искомое значение может находиться в любой части атрибута\
**X\[href^="http"]** - указываем начальное значение атрибута\
**X\[href$=".jpg"]** - указываем конец значения атрибута\
**X\[data-\*="foo"]** - используя пользовательские атрибуты\
**X\[foo\~="bar"]** - Знак *\~* (тильда) позволяет нам выбирать атрибуты со значениями, разделенными пробелами

Селекторы псевдоэлементов\
**X:before, X:after, ::first-letter, ::first-line, ::selection**

"Селектор отрицания"\
**X:not(selector)**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mogorodnik.gitbook.io/html-and-css-education-articles/web-dev_edu-plan/css-selektory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
