Give Assessment for Table Skill Test

Hi
I need an assessment for the MDN Table Guide skill test.

See my code.

What improvement you see may I make on the code? Eager to hear you.

Nie work, @umarFaruq

As an alternative for the alignment rules, you could also set them with a simpler more general rule and then change them for the footer where necessary:

tr :nth-child(2),
tr :nth-child(3) {
  text-align: right;
}

tr :nth-child(1),
tr :nth-child(4) {
  text-align: left;
}

tfoot tr :nth-child(1) {
  text-align: right;
}

tfoot tr :nth-child(2) {
  text-align: left;
}

Nothing wrong with your solution. It’s more a matter of taste. More rules, but simpler selectors. Note that I don’t mention the element with the :nth-child(). When using it like this, it applies to the child regardless what element it is.

I hope this gives you an idea how to approach it a bit differently. :slightly_smiling_face:

Have a nice weekend,
Michael

1 Like

Wow! Thanks, @mikoMK. It is nice, clean and -as you described it- simpler. I love your taste. I was thinking of something similar but couldn’t manage in the end.

It was an eye-opener. I appreciate it. :slightly_smiling_face:

1 Like