Andy68man Andy68man - 1 month ago 5
CSS Question

CSS for td in table using a wildcard

I'm having some trouble with some CSS. I have a number of unique tables with a similar format name, and I need to set the background color on some of them. However, if I try and use a wildcard the style gets overwritten by a parent CSS file.

The background colour here works fine:

#AllProtectedServers1 td.status.online{
color: green;
background-color: yellow;
font-weight: bold;
}


But the background colour doesn't work here as it's being overwritten higher up (although everything else does):

td.status.online {
color: green;
background-color: yellow;
font-weight: bold;
}


I'm going to have 20+ tables all starting with "AllProtectedServers", so naming them all individually is going to make the css huge. Is there anyway I could use a wildcard? I've tried using
div[id^='id_']
and similar selectors without any luck.

Anyone have any ideas of what I could use instead?

Update:
Please note the ID's are unique (AllProtectedServersCompany1, AllProtectedServersCompany2, etc), but they all start with AllProtectedServers. I want to create some CSS that will override the stylesheet for the table that is overriding my changes and use a wildcard so I don't have to specify each one.

Answer

Maybe this would help:

td.status.online
{
   color: green;
   background-color: yellow !important;
   font-weight: bold;
 }
Comments