Search code examples
htmlcssmedia-queries

What are some ways to use different background colors in CSS?


Let's say I have 5 webpages and on each webpage I want the background color to be different. I am using only 1 css file. Each webpage will be accessed like this: domain.com/page1

Do I simply using 5 different CSS files and just change the background-color in the body or is there a more simpler way to achieve this?


Solution

  • Add different class to your <body> on each site, and then use that class to get proper background color.

    Of course, you don't have to multiply code, that is common to all sites.