0 votes
114 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 88 views
0 votes
1 answer 109 views
0 votes
1 answer 111 views
0 votes
1 answer 162 views
0 votes
1 answer 138 views
0 votes
1 answer 123 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

561 users

...