Multiple Selectors
In order to make CSS more concise, it's possible to add CSS styles to multiple CSS selectors all at once. This prevents writing repetitive code.
For instance, the following code has repetitive style attributes:
h1 {
font-family: Georgia;
}
.menu {
font-family: Georgia;
}
Instead of writing
font-family: Georgia twice for two selectors, we can separate the selectors by a comma to apply the same style to both, like this:
h1,
.menu {
font-family: Georgia;
}
By separating the CSS selectors with a comma, both the
h1 and the .menu elements will receive the font-family: Georgia styling.
0 comments:
Post a Comment