In this tutorial you will learn about the CSS Group Selector and its application with practical example.
If we want to apply same styling to multiple selectors then they can be declared together. This is called “grouping”.Just separate the selectors with a comma.
Table Of Contents−
Syntax:
1 |
[Selector 1], [Selector 2],.....N { property:value;} |
Example:
For example, if <h1>, <h2>, and <h3> share they same style, they can be declared together as follows:
1 |
h1,h2,h3 { color: red} |
You can combine various ID selectors together as shown below:
1 2 3 4 |
#nav, #content, #footer, #header{ left: 500px; width: 250px; } |