Wednesday, 15 February 2012

html - Apply css to elements with same pattern -



html - Apply css to elements with same pattern -

i have elements in html:

<div id="element0div0"> div 0 </div> <div id="element1div1"> div 1 </div> <div id="element2div2"> div 2 </div>

can utilize regex apply css element element{n}div{n}?

there's no regular look differentiate between numbers , letters, can approach solution using:

div[id^=element][id*=div] { /* css */ }

this has flaws in match next (and more) id strings:

elementdiv elementsomeotherstringdiv elementdivsomeotherstring

i'd suggest, given nature of question, it'd far wiser utilize mutual class-name elements wish apply mutual style.

references:

css attribute-selectors.

html css regex

No comments:

Post a Comment