Graphics Programs Reference
In-Depth Information
In a simple table with rows consisting of nothing but data cells (those are
td
elements), you
can select every other column like so (see also Figure 7-11):
td:nth-child(odd)
{
background
:
#FED
;}
Figure 7-11: Styling the odd-numbered columns.
Want to i ll in the alternate ones, as in Figure 7-12? Easy-peasy!
td:nth-child(odd)
{
background
:
#FED
;}
td:nth-child(even)
{
background
:
#DEF
;}
244
If you're at er every third (Figure 7-13), fourth, i t h, or similarly spaced-out interval, then you
need the
n+1
pattern.
td:nth-child(3n+
1) {
background
:
#EDF
;}
Figure 7-12: Styling both odd- and even-numbered columns.


























Search WWH ::

Custom Search