Forum Moderators: not2easy

Message Too Old, No Replies

text-decoration:none for only 1 class

How to?

         

txbakers

6:11 pm on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.smbtxt
{
font-size:x-small;
font-weight:bold;
text-decoration:none;

}

For this class, I would like the <A href> tag to show no underlines. What is the syntax for making this happen?

Thanks.

Longhaired Genius

6:35 pm on May 16, 2005 (gmt 0)

10+ Year Member



Move "text-decoration:none;" to here:

.smbtxt a
{
text-decoration:none;
}

tedster

6:37 pm on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.smbtxt a {text-decoration:none;}

That syntax is known as a "descendant selector" and will choose all "a" elements that are descendants of any element in the class smbtxt

If you dont want this to apply more than one level "deep" into the descendants of the class, you can use the child selector syntax, which will only apply to the immediate "child" and not to "child of a child"

.smbtxt > a {text-decoration:none;}

The reason that the original css didn't work is the cascade - even though the class has a "non" rule, the a element is further along in the cascade than the element with that class, and so a rules will take precendence over the earlier css class.

createErrorMsg

8:33 pm on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you dont want this to apply more than one level "deep" into the descendants of the class, you can use the child selector syntax, which will only apply to the immediate "child" and not to "child of a child"

A small, but important, addition to this is the fact that IE/Win provides no support for the child selector. Reliable cross browser targetting in cases where the descendant selector is too broad requires the use of IDs or CLASSes.

cEM

natty

3:13 pm on May 17, 2005 (gmt 0)

10+ Year Member



hi all,

s maybe a little off topic, but i always do

a.smbtxt{
/*styles*/
}

is that bad skills?
i understand that this means that it will not be useable on other elements unless i also do a
.smbtxt{
blah...
}
but just wondering on peoples thoughts on this..

nat