2013-05-23 18:25, Denis McMahon wrote:
> I tried to do this:
>
> td {padding: inherit 1em}
That's incorrect: the value is malformed, hence conforming browsers
ignore the declaration. The syntax is:
<padding-width>{1,4} | inherit
http://www.w3.org/TR/CSS2/box.html#propdef-padding
So you can use inherit but only as standalone value, implying that all
subproperties (in the four directions) are inherited.
> but found that instead I had to do this:
>
> td {padding-left: 1em;padding-right: 1em}
That sets those specific padding properties, without affecting vertical
padding (which is usually 1px by default, for td).
> I expected that 'inherit' would apply to individual values of the multi-
> value list, but that doesn't seem to be the case.
No, it isn't. The validator
http://jigsaw.w3.org/css-validator/ is
laconic, as so often, but it clearly says that td {padding: inherit 1em}
is incorrect:
Value Error : padding Too many values or values are not recognized :
inherit 1em
It would be somewhat odd to have padding inherited in the first place.
When could you conceivably want to make an element inherit padding from
its parent. Under any normal circumstances, the padding of tr is 0, but
then why would you use inherit, instead of the value 0? You could use
td { padding: 0 1em; }
On the other hand, if you want the *default* vertical padding, then
inherit is not the way. Instead, just declare what you expect to be the
default, e.g.
td { padding: 1px 1em; }
--
Yucca,
http://www.cs.tut.fi/~jkorpela/