W3C home > Mailing lists > Public > www-style@w3.org > August 2001

multiple uses of a class in a single CSS file

From: Heather Gray <hgray@tardis.nu>
Date: Fri, 3 Aug 2001 13:35:08 -0400 (EDT)
Message-ID: <20010803114157.A18458@tardis.nu>
To: www-style@w3.org

Hello,

Sorry if this has been addressed long ago...I searched the mailing list archives
and couldn't find anything relevant!

I have a bit of CSS I'd like to share with you. It was written by someone else.
It appears in a single CSS file.

.announce {
              background: #CCCCCC;
}

A.announce {
                font-size: 90%;
                font-family: arial, helvetica;
                color: #003366;
                text-decoration: underline;
}

div.announce{
                text-align: center;
                background: #CCCCCC;
}

TR.announce {
                padding: 20px;
}

The person who wrote this argues that each of these elements, such as div,
should "inherit" the gray background specified in .announce and add the other
elements (don't ask me why she also added the gray background, then). From
what I understand of inheritance, her interpretation is not inheritance at all.

Please let me know if this use of class is wrong and why. I am having a hard
time coming up with documentation that specifies why this is wrong and why it
shouldn't necessarily work the way she thinks it will. I have tried to explain
that the "a," the "div," and the "tr" should have separate IDs each:

<div class="announce" id="otherthing">Hey everyone!</div>
<tr class="announce" id="fatcells"><td>Hi again!</td></tr>
<a class="announce" id="speciallink" href="file.html">Follow this link</a>

But that doesn't explain why this same-class scheme DOESN'T work.
Or maybe I don't understand CSS and it should work the way she says.

Thanks,
Heather
Received on Thursday, 9 August 2001 06:26:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:10 GMT