CSS problem

J

Jibba Jabba

Ok looks like I've encountered another CSS problem, where I can't seem to
override a previous CSS class.

Look at the following source code. If the "tcat" class is taken off the
<td> tag, then the "usrimg" class will work. Why can't class "usrimg"
override the "tcat" class?



<HTML><HEAD>
<style type="text/css">
<!--

..usrimg
{
}
..usrimg a:link
{
color: #0066CC;
font: bold;
}
..usrimg a:visited
{
color: #0066CC;
font: bold;
}
..usrimg a:hover, a:active
{
color: #FF0000;
font: bold;
}

..tcat
{
}
..tcat a:link
{
color: #FFFFFF;
text-decoration: none;
}
..tcat a:visited
{
color: #FFFFFF;
text-decoration: none;
}
..tcat a:hover, .tcat a:active
{
color: #FFFF66;
text-decoration: underline;
}
</style>

<body>
<table cellpadding="6" cellspacing="1" border="0" width="800">
<tr align="center">
<td class="tcat" align="left">
<div class="usrimg"><a href="df">dfsdf</a></div>
</td>
</tr>
</table>
</body>
</html>
 
M

Mark Parnell

Look at the following source code. If the "tcat" class is taken off the
<td> tag, then the "usrimg" class will work. Why can't class "usrimg"
override the "tcat" class?

Because in your CSS file, .tcat is defined after .usrimg. They are both
formed the same, so have the same specificity, therefore the last one
takes precedence. Perhaps you should read up on the "cascading" part of
CSS.

http://www.w3.org/TR/REC-CSS2/cascade.html#cascade
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,184
Latest member
ZNOChrista

Latest Threads

Top