2016-08-08 2 views
1
<head> 
<style> 
table, th, td { 
border: 1px solid black; 
border-collapse: collapse; 
} 
th { 
font-family: arial; 
font-weight: normal; 
} 
</style> 
</head> 
<body> 
<table width="200" height="300"> 
<tr style="font-weight: bold"> 
    <th>Year</th> 
    <th>Balance</th> 
    <th>Interest</th> 
</tr> 
</table> 
</body> 

특정 클래스를 제외한 모든 것을 CSS 대상으로 만들 수있는 방법이 있습니까? 특정 클래스를 제외하고 모든 th 태그를 대상으로 지정하고 싶습니다. :not 확실히 하나 개의 대안으로 사용 https://developer.mozilla.org/en/docs/Web/CSS/:not특정 클래스를 제외한 모든 것을 대상으로 지정하십시오.

답변

1

당신은 :not

li:not(.different) { 
    font-size: 13px; 
} 

참조를 사용할 수 있습니다.

th  { font-weight: bold; } 
th.normal { font-weight: normal; } 
2

하지만 고전적인 CSS 방식은 특정 두 가지 규칙, 일반적으로 첫 번째를 작성하는 것입니다 :

관련 문제