Francis L.
Francis L.

Reputation: 7

Avoiding multiple unique divs in single page CSS

I have would like to combine all my CSS files into a single file to lessen the load on the server, however, I use quite a number of divs with the same name on the page, but they are styled differently.

How do I style the single page CSS to specify that this section is for X.html only and what do I need to add in the X.html?

Thanks in advance!

Upvotes: 0

Views: 51

Answers (1)

Pete
Pete

Reputation: 58462

You can give each page an id and then target that id and div specifically. For example

Page one:

<body id="page-one">
   <div class="content"></div>
</body>

Page two:

<body id="page-two">
   <div class="content"></div>
</body>

and then styles like

#page-one .content {background:red;}
#page-two .content {background:blue;}

Upvotes: 1

Related Questions