user6683711
user6683711

Reputation:

Target everything except a certain class

<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>

Is there a way to make CSS target everything EXCEPT a certain class? I would like it to target every th tag EXCEPT a certain class.

Upvotes: 1

Views: 106

Answers (2)

user663031
user663031

Reputation:

Using :not is certainly one alternative, but the classic CSS approach is to write two rules, general first, then specific.

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

Upvotes: 2

Netorica
Netorica

Reputation: 19327

you can use :not

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

Reference: https://developer.mozilla.org/en/docs/Web/CSS/:not

Upvotes: 1

Related Questions