0 votes
339 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 278 views
0 votes
1 answer 365 views
0 votes
1 answer 852 views
0 votes
1 answer 909 views
0 votes
1 answer 719 views
0 votes
1 answer 305 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

648 users

...