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)
Question
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
Solution
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)
OTHER TIPS
Or you can use a single class for all li
to which style is to be applied
build the id with a loop instruction,
for (i .....) id="abc_dev_view_menu_i"+i;