Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Css Frustrations
#1
Posted 05 February 2005 - 06:33 PM
If I define a class, which includes background color, font colors, text-decoration & link attributes, I can't get the link conditions to cascade when the class is assigned to a <table> or <tr> or <td> tag. Background and font size work, color for standard text works, but none of the link attributes do.
It works fine when I assign the class directly to the <a> tag so I'm pretty sure I have the syntax right.
I'm sure it's not necessary for every <a> tag w/in a table to need a class specifically called out, what the heck am I doing wrong?
#2
Posted 05 February 2005 - 07:01 PM
Actually, I think you do. Now, if you set an ID for the table, and set all the pseudoclasses for links within that ID a certain way, I think you could just use <a> for links inside the table that holds that ID.
...I think.
#3
Posted 05 February 2005 - 07:23 PM
color: #000;
font-size: 80%;
}
.classname a {
color: #369;
}
It really shouldn't be any more difficult than that ...
#4
Posted 05 February 2005 - 08:11 PM
But why does this syntax as I've seen it described in almost every tutorial I've read, NOT cascade in a table (though works in an <a> or <span>):
font-family: "Veranda", Arial, Helvetica, sans-serif;
color: #00EE00;
}
a.txt:link {
color: #00EE00;
}
a.txt:visited {
color: #00EE00;
}
a.txt:hover {
color: #EE0000;
text-decoration: underline;
}
And this syntax does cascade?
font-family: "Veranda", Arial, Helvetica, sans-serif;
color: #00EE00;
}
.txt a {
color: #00EE00;
}
.txt a:hover {
color: #EE0000;
text-decoration: underline;
}
Edited by arlen, 05 February 2005 - 09:12 PM.
#5
Posted 05 February 2005 - 09:12 PM
Your second sample will apply to markup like this:
See the difference?
warmly,
Lea
#6
Posted 05 February 2005 - 10:31 PM
.txt a means any A element found inside anything assigned a class of txt
#7
Posted 05 February 2005 - 10:54 PM
#8
Posted 06 February 2005 - 12:37 AM
I'll bet dollars to donuts it's not something you'll ever forget.
#9
Posted 06 February 2005 - 08:23 AM
Just for clarification, if my css includes table.txt rather than just .txt, can I still define .txt a, or would that not work?
Edited by qwerty, 06 February 2005 - 08:42 AM.
#10
Posted 06 February 2005 - 09:02 AM
That being the case, I would use table.txt a to define my links, if only to be consistent. Whether it would "work" without the element specifier or not, I'm not sure.
<added>Okay, a quick test confirms that .txt a works for both table.txt and div.txt
div.txt { color: #080; }
.txt a { color: #369; }
Using the styles above, content text comes out red in a table, green in a div, with links in both the table and div a nice light azure. I can see some real uses for that in cutting down the amount of code needed in many situations.
#11
Posted 08 February 2005 - 09:54 PM
Yes, it would work.
.txt is the class. Using "table.txt" you're assigning the class "txt" to "table". By using ".txt a", you're assigning the properties of "a" to class "txt"
<style>
<!--
table.txt {color: #000000 }
.txt a:link { color: #FF0000; text-decoration: none }
.txt a:visited { color: #00FF00; text-decoration: none }
.txt a:active { color: #0000FF; text-decoration: none }
.txt a:hover { color: #0000FF; text-decoration: none }
-->
</style>
I find it easier to by only defining classes as in the following unless aboslutely necessary to use something else:
.txt { color: #000000} and avoiding table.txt { color: #000000}
Keep it simple but don't over-simplify!
Edited by maleman, 08 February 2005 - 10:17 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users








