What's the proper format?

Also does anyone know where i can find a good CSS online reference besides W3Schools?

Current Code.

.className td {border: 1px solid #CCC;}
.className th {border: 1px solid #CCC;}

i want to save some characters... would this be valid?

.className td th {border: 1px solid #CCC;}

or

.className td, th {border: 1px solid #CCC;}

or

.className td, .className th {border: 1px solid #CCC;}

Recommended Answers

If you're still looking for a good online CSS reference, these are the ones I use most often:
http://www.zvon.org/xxl/css1Reference/Output/index.html
http://zvon.org/xxl/CSS2Reference/Output/index.html

Jump to Post

Yes, I use that latter version as well.

Jump to Post

All 6 Replies

nevermind

This is valid in CSS.

.className td, .className th {border: 1px solid #CCC;}

Yes, I use that latter version as well.

I use the
.className td, th method myself.

Both .className td, th {border: 1px solid #CCC;} and .className td, .className th {border: 1px solid #CCC;} are valid. They simply tell the browser different things.

The first states that the styles should be applied to any td element within an element with a class of className , and any th element within the document. The second states that the styles should be applied to any td element within an element with a class of className , and any th element within an element with a class of className .

If that doesn't make sense I can post an example.


Regards, Arkinder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.