Apply different css stylesheet for different parts of the same web page [duplicate]

You can’t apply different stylesheets to different parts of a page. You have a few options:

The best is to wrap the different parts of the page in divs with class names:

<div class="part1">
    ....
</div>

<div class="part2">
    ....
</div>

Then in your part1 CSS, prefix every CSS rule with “.part1 ” and in your part2 CSS, prefix every CSS rule with “.part2 “. Note that by using classes, you can use a number of different “part1” or “part2” divs, to flexibly delimit which parts of the page are affected by which CSS rules.

Leave a Comment