I was using a generic rule for TH
tag of Table
but it disturbed every thing. I was using the rule as:
th
{
color: #fff;
background: #7d7e7d;
}
But now I want to specify Ids for a few tables so that it does not effect other tables at all. What I did was:
#id1,#id2 th
{
color: #fff;
background: #7d7e7d;
}
what it did that color spread in as well. How do I achieve my task?
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.
It is possible to give several items on your page the same style even when they don't have the same class name. To do this you simply list all of the elements you want to style and put a comma between each one.
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.
Yes. It still will receive the style specified by the last selector in order from top to bottom that refers to the html element specified. The order in which the class names appear in the element tag itself will make no difference.
You need to specify th
both times as the comma separates entire selectors:
#id1 th, #id2 th
{
color: #fff;
background: #7d7e7d;
}
Otherwise you're selecting the entire #id1
as well as just #id2 th
.
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