How css implements different ways of grouping selectors and declarations
This article mainly introduces css how to achieve the selector and declaration grouping of different methods, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
All the rule groups in the following example are equivalent, and each group simply shows a different way to group selectors and declarations:
/ * group 1 * / h2 {color:silver; background:white;} h3 {color:silver; background:gray;} h4 {color:white; background:gray;} h5 {color:silver; background:white;} b {color:gray; background:white;} / * group 2 * / H2, h3, h5 {color:silver;} h3, h4 {background:gray;} H2, h5, b {background:white;} h4 {color:white;} b {color:gray;} / * group 3 * / H2, h5 {color:silver; background:white } h3 {color:silver;} h4 {color:white;} h3, h4 {background:gray;} b {color:gray; background:white;}
Try it for yourself:
Group 1
Group 2
Group 3
Notice that "declaration grouping" is used in group 3. We will introduce the "declaration group" to you later.
Thank you for reading this article carefully. I hope the article "how to implement different ways of grouping selectors and statements by css" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!