php - How match ID number with CSS regexp -
i'm customising wordpress theme , stuck following css issue. have list of elements follows:
li.block1, li.block2, li.block3, li.block4 { top: 0; } li.block5, li.block6, li.block7, li.block8 { top: 150px; } li.block9, li.block10, li.block11, li.block12 { top: 300px; }
i'm generating code using php , wish use regexp style these elements. i'd achieve following:
- li.block[1-4] {style 1} - li.block[5-9] {style 2} - li.block[10-14] {style 3} - , on...
as i'm generating li.block[number]
dynamically based on user input, run few hundreds of elements, believe using regexp right way go.
i've tried following:
- tried use $ match last element, i'd on how match on range of values
- tried using last-child attribute match, it's dynamic, can't fix last-child in advance
- tried use in-range match range, couldn't figure out how check whether number in range
- and, several other dom matching criteria using css
i think css match condition i'm using erroneous, i'd request experts in forum show me how use $ , range:
how use regexp based on: li.block[number,i, in range a-b] {apply style number, i}
?
i'm open other ideas me keep theme dynamic.
thanks in advance, mithun sridharan
css don't know regexp, can use ~
:
li {top: 0;} li.block4 ~ li {top: 150px;} li.block8 ~ li {top: 300px;}
Comments
Post a Comment