On Sep 3, 2010, at 9:23 AM, Kim Brooks Wei wrote:
> I have nth child even-odd styling on this page set up as an ID. When I
> changed this to class so I could set up a second styled section farther down
> the page the styling broke. Any ideas as to why?
> http://bit.ly/ad7AEl
I don't see any classes that are related in your page / stylesheet.
In principle, it should work, independently of classes vs id. The thing that
might be tripping you, as Alan alludes, is specificity. You make your selectors
very specific already. [1]
On Sep 3, 2010, at 5:00 PM, Alan Gresley wrote:
>> Is there something else IE consumes without indigestion that will permit me
>> to color the background on every second listing in a ul?
>> Cheery Kimi
>
>
> For IE7+ this will work. Very cumbersome.
>
> ul#colored1 li { /* even style */ }
> ul#colored1 li+li { /* odd style */ }
> ul#colored1 li+li+li { /* even style */ }
> ul#colored1 li+li+li+li { /* odd style */ }
> ul#colored1 li+li+li+li+li { /* even style */ }
> ul#colored1 li+li+li+li+li+li { /* odd style */ }
beyond cumbersome :-)
What is wrong with attaching a class to the li ? Much more efficient on so
many levels.
li class="alternate-color"
If you can't change the markup, then JS is your friend; David pointed to jquery
- I've used for some project to do exactly that, quite efficient.
[1]
ul# li {}
specificity: 102
ul#id li:nth-chil(odd) {}
specificity: 112
ul.class li:nth-child(odd)
specificity: 22
Philippe
---
Philippe Wittenbergh
http://l-c-n.com/
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/