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
2009-02-09 16:24:04
While technically correct, I think the OP is looking for more of a simple lookup table for quicker reference.
Joel Coehoorn
2009-02-09 16:24:56
I must admit I'd love to see that too :) He specifically asked for a spec he could reference, though.
Aron Rotteveel
2009-02-09 16:28:25
@Joel isn't technically correct, the best kind of correct :P
Ólafur Waage
2009-02-09 16:34:12
A:
You could always use the official spec. The answer to your particular question is here.
CodeMonkey1
2009-02-09 16:26:06
+3
A:
This would be the summary you are looking for. Taken directly from the W3.org website.
lpfavreau
2009-02-09 16:32:31
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
2009-02-09 18:51:35
A:
pffft, you're all liars, there's only one property that can be applied to one element.
h1 { blink: fast; }
gargantaun
2009-02-10 15:04:38