예를 들어 다음 HTML이있는 경우 :
<div class="someDiv"></div>
그리고이 CSS :
.opacity {
filter:alpha(opacity=60);
-moz-opacity:0.6;
-khtml-opacity: 0.6;
opacity: 0.6;
}
.radius {
border-top-left-radius: 15px;
border-top-right-radius: 5px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
}
.someDiv {
background: #000; height: 50px; width: 200px;
/*** How can I reference the opacity and radius classes here
so this div has those generic rules applied to it as well ***/
}
스크립팅 언어에서 스크립트 상단에 자주 사용되는 일반 함수가 있고 해당 함수를 사용해야 할 때마다 매번 모든 코드를 반복하는 대신 함수를 호출하기 만하면됩니다.
.radius와 같이 쉼표로 구분 된 클래스 목록을 추가 할 수 있습니다 .radius, .another, .element{/* css*/}. 그러면 추가 코드가 절약되지만 가독성이 떨어질 수 있습니다.