CSS: using a single rule for multiple identifiers

I used the general rule for the TH Table tag, but that violated everything. I used the rule like:

 th { color: #fff; background: #7d7e7d; } 

But now I want to specify identifiers for several tables so that they do not affect other tables at all. I have done this:

 #id1,#id2 th { color: #fff; background: #7d7e7d; } 

what he did, and that color spread. How can I complete my task?

+4
source share
1 answer

You need to specify th both times since the comma separates the whole selectors:

 #id1 th, #id2 th { color: #fff; background: #7d7e7d; } 

Otherwise, you select all #id1 , and also just #id2 th .

+6
source

Source: https://habr.com/ru/post/1413304/


All Articles