2017-12-04 3 views
1

본문 클래스에서 더 많은 클래스를 호출 할 수 있습니까? 나는 예를 가지고있다.본문 클래스로 호출 클래스

본문 클래스 "body-class"가 있습니다. 이 바디 클래스를 사용하여 해당 페이지에서만 다른 클래스를 지정합니다. 내가 항상하는 것은 다음과 같이이다 :

body.class-for-body .other-class, 
body.class-for-body .other-class-new, 
body.class-for-body .other-class-more, 
body.class-for-body .other-class-left { 
    styling shizzle 
} 

그러나 나는 또한 클래스와 함께 몸이 "클래스를 위해 newbody"같은 서브 클래스와 :

body.class-for-newbody .other-class, 
body.class-for-newbody .other-class-new, 
body.class-for-newbody .other-class-more, 
body.class-for-newbody .other-class-left { 
    styling shizzle 
} 

함께 그들에게 전화하는 방법이 있나요 ?

감사합니다, 로버트

+1

당신은 CSS 처리기를 사용하거나 규칙의 두 세트를 결합 할 수 있습니다. – j08691

답변

3

또한 예를 들어, 와일드 카드 선택기를 사용할 수 있습니다 ...

body[class*='class-for-'] { 
    /* todo */ 
} 
+0

니스, 고마워! 그거 알아두면 좋을거야 :) – n00bly

관련 문제