How do I do it.
#foo, #ball, #tree h1 {color: #892828;}
Does not seem to work?
You cannot have multiple IDs for a single div tag. There is never any need for multiple ids on the same tag since ids are unique either one would serve to uniquely identify that specific tag provided you first get rid of the other id which is stopping things working.
CSS IDS. An ID is a singular identifier of one HTML tag. You can only have one HTML tag per ID and each HTML tag can only have one ID. Each ID has a specific set of CSS attributes that only apply to that one element.
Multiple classes can be applied to a single element in HTML and they can be styled using CSS.
When you group CSS selectors, you apply the same styles to several different elements without repeating the styles in your stylesheet. Instead of having two, three, or more CSS rules that do the same thing (set the color of something to red, for example), you use a single CSS rule that accomplishes the same thing.
if you want to style all H1 under those Ids, you have to repeat H1 for every one as they don't share anything:
#foo h1, #ball h1, #tree h1 {color: #892828;}
what you wrote is equivalent to:
#foo {color: #892828;} #ball {color: #892828;} #tree h1 {color: #892828;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With