Adding Background-color in the row of the table


How to add background color as black and white in the row of table as that of above image? At the end , the table should look like the given image?

Can you post the link to the challenge or is this your own project?

Post your html and css file.

Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.

Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.

Fruits Vegetables
Apple Potato
Orange Carrot
Tomato Parsnip
Kiwi Onion
Banana Beet

(This is from task 3)

 tr:nth-child(odd) {
  background: #333;
  color: white; /* Set text color for better contrast */
}

I did this in the Code pen editor and also ran it on MDN.

As said, you can use the :nth-child() selector.

@robheyays As this is a learning project we should leave it to them as an exercise. I would suggest blurring your answer.

Ok is this the same as a spoiler? Also I guess Im a bit confused as to what I should of posted.

Yes, it is called “blur spoiler” in the menu. I can do it for you.

If you are asking if I think what you posted is a spoiler, then yes, in this context where it is a learning tutorial asking for a solution.

1 Like

thanks .This really worked.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.