[Web4lib] CSS3 selector question - nth-child(even)
Andrew Hankinson
andrew.hankinson at gmail.com
Sun Dec 5 00:12:23 EST 2010
Oh, sorry - my mistake. I completely skipped the link!
I had a look at this, and I don't think there's a way to do this with just CSS. The nth operators seem to only operate on the element level, not on the class level.
-Andrew
On 2010-12-01, at 10:05 AM, Thomas Dowling wrote:
> Greetings--
>
> Attempting to do my six impossible things before breakfast, I ran up
> against a CSS3 problem. Or more likely, a dissonance between how I think
> things should work and reality.
>
> (More concise and less rambling example of the problem below at
> <http://www.ohiolink.edu/~tdowling/even-test.html>).
>
> I'm trying to display alternate entries in a list with a colored
> background using the CSS3 'foo.bar:nth-child(even)' selector. My
> expectation was that, whatever else the page had, alternate occurrences of
> '<foo class="bar">' would have the background.
>
> Instead, I get the background on even-numbered <foo>'s *if* they happen to
> be 'class="bar"'. That's a very different thing if you have to work
> around markup that may throw in other kinds of <foo>'s.
>
> Am I simply trying to do something that can't be done? FWIW, the
> underlying HTML markup is generated by a third-party app and I can't
> control the page in question.
>
>
>
> --
> Thomas Dowling
> tdowling at ohiolink.edu
>
>
>
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/
>
More information about the Web4lib
mailing list