views:

145

answers:

5

I'm looking for a source/spec that can tell me what CSS properties can applied to which HTML elements. For instance, the css property; "overflow". I know I can apply this to div, p, textarea but what other elements can I apply this too? Is there a spec somewhere I can reference?

+6  A: 

See http://www.w3.org/TR/CSS2/ and http://www.w3.org/TR/CSS/.

For example, regarding your question about the overflow property, see:

http://www.w3.org/TR/CSS2/visufx.html#overflow-clipping, stating:

'overflow'
    Value:          visible | hidden | scroll | auto | inherit
    Initial:        visible
    Applies to:     block-level and replaced elements
    Inherited:      no
    Percentages:    N/A
    Media:          visual
Aron Rotteveel
While technically correct, I think the OP is looking for more of a simple lookup table for quicker reference.
Joel Coehoorn
I must admit I'd love to see that too :) He specifically asked for a spec he could reference, though.
Aron Rotteveel
@Joel isn't technically correct, the best kind of correct :P
Ólafur Waage
A: 

You could always use the official spec. The answer to your particular question is here.

CodeMonkey1
+3  A: 

This would be the summary you are looking for. Taken directly from the W3.org website.

lpfavreau
A: 

Any CSS property can be applied to any HTML element; they don't restrict each other.

However, as Aron Rotteveel mentioned, the element will have to be either a replaced element (like img), or specified to be block-level. That mean that the following is perfectly fine CSS:

strong { display: block; height: 5em; width: 5em; overflow: scroll; }
Ms2ger
A: 

pffft, you're all liars, there's only one property that can be applied to one element.

h1 { blink: fast; }

gargantaun