1

I have a class *, but I can't override the proporties in this class later on? Why...?

* {
    font-family:tahoma;
    font-size:11px;
    color:#3c6b93;
}

eg

.test {
    font-size:17px;
    color:red;
}

only way the .test class can override is I delete each specific proporty in the * class

Jared Farrish
  • 48,585
  • 17
  • 95
  • 104
clarkk
  • 27,151
  • 72
  • 200
  • 340

2 Answers2

1

So this is how I do it:

body {
    font:11px/1.2 Tahoma, sans-serif;
    color:#3c6b93;
}

.test {
    font-size:17px;
    color:red;
}

The above properties trickle down (to descendant elements). Therefore, you define the most general rules on the body element. Now, unless overridden, those rules will apply to all elements on the page.

Šime Vidas
  • 182,163
  • 62
  • 281
  • 385
0
<html>
<head>
    <style type="text/css">
        * {
                font-family:tahoma;
                font-size:11px;
                color:#3c6b93;
        }
        .test {
            font-size:17px;
            color:red;
        }
    </style>
</head>
<body>
    <div>Text</div>
    <div class="test">Text</div>
</body>
</html>

works as expected in my browser.

nobody
  • 10,599
  • 4
  • 26
  • 43