Consider CSS Attribute-based Selectors
CSS supports a variety of attribute-based selectors, including a "starts with" selector, which you could use to match any classes that began with "idName" as seen below :
/* This will match any classes that start with "idName" */
[class^="idName"] {
background-color: #4CAF50;
}
Likewise, if you wanted to explicitly target the id
attribute, you could do that as well :
[id^='idName'] {
background-color: #4CAF50;
}
Consider reviewing through the various supported selectors detailed in the link above to determine which would best suit your needs.
Example

[class^="idName"] {
background: yellow;
}
<div class="idName1">1</div>
<div class="idName2">2</div>
<div class="idName3">3</div>
<div class="x">X</div>
<div class="idName4">4</div>
<div class="x">X</div>
<div class="idName5">5</div>
<div class="x">X</div>
<div class="idName6">6</div>
<div class="x">X</div>