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?
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
In the CSS processing model, every element has every property that is applicable to the target media type. For example, even the empty <br>
element has the color
property. But whether a property has an effect on the rendering of the element itself depends on the specific property and the context, in a manner that is described in applicable CSS specifications and drafts. It is usually described under an “Applies to” heading. There is no combined compilation of this, and the set of properties recognized by browsers varies considerably.
Even though a property “applies to” an element by the specifications, it need not have an actual effect. For example, border-color
is irrelevant for the rendering of an element if its border-style
is none
or its border-width
is 0
. (The value may still matter if it is inherited by child elements.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With