0 votes
182 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 165 views
0 votes
1 answer 193 views
0 votes
1 answer 303 views
0 votes
1 answer 410 views
0 votes
1 answer 333 views
0 votes
1 answer 173 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!

5.7k questions

5.1k answers

108 comments

623 users

...