On Tue, 13 Mar 2007, David Agnew wrote:

> I use a list within div.features to display featured links. To make it
> easier to read, the background color of alternate list items is a
> different shade

That's similar to alternating backgrounds for table rows, a frequently 
deployed idea. Unfortunately it requires - in both cases - either extra 
class markup or long selectors, and the latter method doesn't work on IE 6 
and older.

> This method works in most browsers including MSIE 7 & 5, but MSIE 6 and
> 5.5 completely ignore the list item background-color(s).

I'm afraid I don't quite see what's happening MSIE 5, 5.5., and 6 surely 
don't support selectors like "li + li", but they all let you set a 
background color for an li element.

>  /* use container wrapper colors for 1st, 3rd, 5th, etc li's */
> #containAbt .features li, #containAbt .features li+li+li, #containAbt
> .features li+li+li+li+li, #containAbt .features li+li+li+li+li+li+li,
> #containAbt .features li+li+li+li+li+li+li+li+li {
>  background-color: #F7EFD5;
> }

That's flexible in a sense, but won't work on IE 6 or earlier due to lack 
of support to "+" in selectors, and it gets somewhat awkward.

I'd suggest the simpler approach of assigning a class, say class="e", to 
the 2nd, 4th, 6th, etc. (i.e., even-numbered) list items and using a 
selector like
.features li
to cover all list items (effective making the settings you want for "odd" 
items) and then
.features li.e
to cover the "even" items. This is boring but gives much better browser 
coverage and avoids the problem of (mis)counting in li+li+li+...

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to