0

Having trouble getting CSS to apply to a table in react. Thought I'd ask here. You guys are probably better than SO. Please and thank you

https://stackoverflow.com/questions...

Comments
  • 2
    Agree with the SO answers. Your CSS selector chain doesn't match the markup hierarchy, and the old HTML you provided probably isn't the complete old HTML.

    Example, the alternate line background. Your CSS:

    table tbody tr:nth-child(2n + 1) {

    background-color: rgba(220, 220, 220, 0.25);

    }

    So your markup must be a table tag, then inside that, a tbody tag, inside that, a tr tag. There may be other levels inbetween, so you don't need that hierarchy directly, but the chain needs to be there. Like, something like a table-div-tbody-div-div-tr would also match the tr.
  • 2
    > "You guys are probably better than SO"

    Ha! He don't know us very well, does he?
  • 2
    @PaperTrail I meant less toxic
  • 1
    Question not clear, delete
  • 0
    Google it probably
  • 0
    @Fast-Nop It's definitely the entire original html. Looking again at the CSS I see what you're saying now I'm just surprised it's been working at all
  • 0
    @Fast-Nop So how's this for strange, adding the tbody tags in the html/react did not solve it but removing them from the css did
Add Comment