0 votes
272 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 223 views
0 votes
1 answer 283 views
0 votes
1 answer 575 views
0 votes
1 answer 665 views
0 votes
1 answer 531 views
0 votes
1 answer 239 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

645 users

...