Reputation: 276
Hy, I want to apply a css style for all my < li > tags after their id...the problem is that these tags have different id(autoincremental)...I made a screenshot in my firebug:
For all < li > items, ID is "abc_dev_view_menu_i*",where * is a number wich increments for each new item I add.
So how to manage this,how to apply the same style for all < li > in this case where the number from ID increments each time I add one item?I tried with javascript,using getElementById but nothing worked until now
Upvotes: 0
Views: 326
Reputation: 123377
Use this attribute selector:
li[id^="abc_dev_view_menu_i"] {
/* common style */
}
this CSS rule will apply a style to each li
whose id
attribute starts with abc_dev_view_menu_i
(regardless of the incremental counter)
Upvotes: 4
Reputation: 319
build the id with a loop instruction,
for (i .....) id="abc_dev_view_menu_i"+i;
Upvotes: 0
Reputation:
Or you can use a single class for all li
to which style is to be applied
Upvotes: 0