Just to point out that you can do this with just id’s by utilizing attribute selectors.
But as others have said, you should really use classes instead
body { background: #333 }
/* ID starts with xyz */
[id^=xyz] {
color: white
}
/* ID ends with _t */
[id$=_t] {
color: red
}
/* ID contains _t_ */
[id*=_t_] {
color: blue
}
<div id="xyz_1"> normal</div>
<div id="xyz_2"> normal</div>
<div id="xyz_3"> normal</div>
<div id="xyz_1_t"> red</div>
<div id="xyz_2_t"> red</div>
<div id="xyz_3_t"> red</div>
<div id="xyz_1_t_1"> blue</div>
<div id="xyz_1_t_2"> blue</div>
<div id="xyz_1_t_3"> blue</div>
solved How can css for id same format [closed]