Reputation: 1776
I have several similar html ids, example:
<il id="DashboardPoolAvailable_1"></il>
<il id="DashboardPoolAvailable_2"></il>
<il id="DashboardPoolAvailable_3"></il>
<il id="DashboardPoolAvailable_4"></il>
....
I need to build a unique CSS code that will work for all the DashboardPoolAvailable_* ids. Something like:
#DashboardPoolAvailable_* { display: inline-block; width: 924px; margin: 0px 13px;
}
Upvotes: 0
Views: 49
Reputation: 1321
If a style is used for more than one element it should really be a class not an id.
consider re-factoring to this:
<div class="DashboardPoolAvailable" id="dash1"></div>
<div class="DashboardPoolAvailable" id="dash2"></div>
<div class="DashboardPoolAvailable" id="dash3"></div>
.DashboardPoolAvailable {
//all shared properties
}
#dash1{ //unique styles}
#dash2{ //unique styles}
#dash3{ //unique styles}
Upvotes: 1
Reputation: 5849
Use E[id^=DashboardPoolAvailable_]
to match your id's
Element E whose attribute id
starts with the value DashboardPoolAvailable_
.
Upvotes: 0
Reputation: 15666
[id^="DashboardPoolAvailable_"]
{
//styles
}
A better way would be to put all the li
's into a UL with a class, and then use something like:
.ul-class li
{
//styles
}
Upvotes: 2