Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Basic Selection in CSS | Basic Introduction
Introduction to CSS Part I

bookBasic Selection in CSS

Element selectors allow you to apply styles to all elements of a specific type on a web page. Let's apply the specified styles to all paragraphs and list items on the web page.

p {
  color: red;
}

li {
  font-size: 16px;
}
  • Element selectors have low specificity, meaning they will be overridden by more specific selectors, such as class or id selectors;
  • They can be combined with other selectors to create more specific styles. For example, you can use a descendant selector to apply a style to all paragraphs that are descendants of a particular element, like this:
#main-content p {
  color: blue;
}

This will apply the specified style to all paragraphs that are descendants of an element with the id main-content;

  • Similarly, another way to use these elements can be to apply a similar style across the board to certain elements. This is done by providing a list of selectors.
h1,h2,h3{
  font-weight: bolder;
  color: red;
}

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

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

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

Секція 1. Розділ 6

Запитати АІ

expand

Запитати АІ

ChatGPT

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

Suggested prompts:

Запитайте мені питання про цей предмет

Сумаризуйте цей розділ

Покажіть реальні приклади

Awesome!

Completion rate improved to 5.26

bookBasic Selection in CSS

Свайпніть щоб показати меню

Element selectors allow you to apply styles to all elements of a specific type on a web page. Let's apply the specified styles to all paragraphs and list items on the web page.

p {
  color: red;
}

li {
  font-size: 16px;
}
  • Element selectors have low specificity, meaning they will be overridden by more specific selectors, such as class or id selectors;
  • They can be combined with other selectors to create more specific styles. For example, you can use a descendant selector to apply a style to all paragraphs that are descendants of a particular element, like this:
#main-content p {
  color: blue;
}

This will apply the specified style to all paragraphs that are descendants of an element with the id main-content;

  • Similarly, another way to use these elements can be to apply a similar style across the board to certain elements. This is done by providing a list of selectors.
h1,h2,h3{
  font-weight: bolder;
  color: red;
}

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

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

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

Секція 1. Розділ 6
some-alt