How can the CSS pseudo-class :nth-child() be applied to create alternating row colors in tables, as suggested in the W3C documentation?

To create alternating row colors in tables using the CSS pseudo-class :nth-child(), you can target every even or odd row and apply different background colors to them. This helps improve the readability and visual appeal of the table for users. By using the :nth-child() pseudo-class with the even or odd keyword, you can easily achieve this effect without the need for additional classes or JavaScript. ```css /* CSS */ tr:nth-child(even) { background-color: #f2f2f2; } tr:nth-child(odd) { background-color: #ffffff; } ```