반응형
<body class="home">
    <div class="top_container">
        <!-- Do something -->
    </div>
</body>

 

<body class="about">
    <div class="top_container">
        <!-- Do something -->
    </div>
</body>

 

.home .top_container{}

.about .top_container{}

 

참고로 형제 관계에선 될지언정 부모 자식관계의 DOM에서는 불가능하다.(부모의 style을 물려받아 원치않는 css가 적용이된다.)

 

 

https://stackoverflow.com/questions/42291000/how-can-i-make-a-same-class-name-unique-to-different-pages

 

How can I make a same class name unique to different pages

I am using single CSS file for all my pages, but I come across with this problem. I have an almost identical (with minor differences) element on two different pages ( let's say home page and about ...

stackoverflow.com

 

반응형