Skip to content

Chapter13: Nth-child() does not work as I expected  #13

Open
@Dexter1996777

Description

@Dexter1996777

Hello everyone!
When I use nth-child, it does not work as I expected. I set the (odd) or (2n+1) value of the attribute for background color, but instead of colouring an odd row, it affects cells that make part of the even row (The Truth or Consequences row).

Here is the code:
tr:nth-child(odd) {
background-color: #fcba7a;
}

Here is the problem that I’m writing about:
Screenshot 2023-03-12 at 18 01 31

Could you help me, please?

Should I use classes instead nth-child()?

P.S. This table comes from the Chapter 13 of Headfirt HTML and CSS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions