Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

CSS Selector

Наши волонтёры ещё не перевели данную статью на Русский. Присоединяйтесь к нам и помогите закончить эту работу!

A CSS selector is the part of the CSS rule that lets you target which element(s) get styled by the rule. For example:

***HTML***
<div> I am inside of a div element. </div>
<p> I am inside of a paragraph element. </p>


***CSS***
div {
 color: green;
}

p {
 color: red;
}

In the first CSS rule, I am selecting the div element and styling it by coloring the text green. In the second CSS rule, I am selecting the p element and styling it by coloring the text red. Here are what these results look like:

CSS selector coding results

 

Learn more

General knowledge

Technical reference

Selectors Level 3

Метки документа и участники

 Внесли вклад в эту страницу: SnoopyRules, ktajpuri, Andrew_Pfeiffer, hbloomer, klez, teoli, ChrisL
 Обновлялась последний раз: SnoopyRules,