0 votes
356 views
in HTML by (2.2k points)
edited
How do you add different background colors or images to each column using CSS?

1 Answer

0 votes
by (98.9k points)
edited

You can add different background colors or images to each column using CSS by targeting individual columns with class selectors and applying the desired background styles. Here's an example:



.column:nth-child(1) {
  background-color: #f0f0f0;
}

.column:nth-child(2) {
  background-image: url("image.jpg");
  background-size: cover;
}

.column:nth-child(3) {
  background-color: #ddd;
}

 

In this example, the CSS code targets each column using :nth-child() selector and applies different background colors or images to each column.

 

 

Related questions

0 votes
1 answer 295 views
0 votes
1 answer 382 views
0 votes
1 answer 912 views
0 votes
1 answer 960 views
0 votes
1 answer 763 views
0 votes
1 answer 323 views
asked Jun 12, 2023 in HTML by radhe (2.2k points)

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

Recent Badges

Doubtly Earned a badge
MrRam Earned a badge
Ritesh Maurya Earned a badge

5.7k questions

5.1k answers

108 comments

648 users

...