Click to See Complete Forum and Search --> : css coding


Beach Bum
12-08-2002, 07:28 PM
most examples i see for css code include a name even when it is not needed, for example they would be something like this:

a.class { blah . . . .

in my css (which works fine in both IE & NS) i have:

.class { blah . . . .

so what is the "a" for (and always an "a") and what does it mean when it has no need to be there?

I understand when name is needed, for example:

P.class { blah . . .

but when it is not needed many examples always put an "a" there.

gil davis
12-08-2002, 08:08 PM
When it's not there, then it can be applied to any tag as necessary. When you specify

tagName.className

and try to apply the class name to a different tag, it's not supposed to work.

all.className

and

.className

are apparently equivalent.

a.className

should only work for anchors.

Beach Bum
12-08-2002, 11:15 PM
thanks gil - that makes perfect sense. i have just seen so many examples that have always had the "a" i thought there may be more to it. so i was not associating the a with anchors. should have - duh . . . sometimes you just can't see the trees.

Stefan
12-09-2002, 05:41 AM
Originally posted by gil davis
[B]
all.className

and

.className

are apparently equivalent.


No they are not.

*.class and .class is though

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