If I had 5 divs with ids "element1", "element2", etc..., is there a way to style an array of elements with something like:
#elements[1-10]{
position:relative;
}
I know you guys probably think I'm nuts, but I'm dealing with some code that is auto generated and I would have to edit the core files of this cms which I don't want to do in case client upgrades in future.
With that said, it is out of the question for me to change the IDs manually to a class.
This works in many modern browsers... except IE:
<style type="text/css">
p[id*=elements] {
color: #F00;
}
</style>
HTML
<p id="elements1">Elements 1</p>
<p id="elements2">Elements 2</p>
<p id="elements3">Elements 3</p>
<p id="elements4">Elements 4</p>
<p id="elements5">Elements 5</p>
But there's - of what I know - no way of limiting it.
I think there's no arrays in CSS. Have you tried considering jQuery?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With