这篇翻译不完整。请帮忙从英语翻译这篇文章

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;
}


/* data-*="" */

/* <p data-test*="test abc xyz" /> */

[data-test*="test"]​​​​​​​


 

 

 

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

文档标签和贡献者

标签: 
 此页面的贡献者: xgqfrms-GitHub
 最后编辑者: xgqfrms-GitHub,