Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

inherited padding

3 views
Skip to first unread message

Denis McMahon

unread,
May 23, 2013, 11:25:14 AM5/23/13
to
I tried to do this:

td {padding: inherit 1em}

but found that instead I had to do this:

td {padding-left: 1em;padding-right: 1em}

I expected that 'inherit' would apply to individual values of the multi-
value list, but that doesn't seem to be the case. Does the assembled
expertise think it should? Firefox 21 / Ubuntu 12.04.2 LTS.

--
Denis McMahon, denismf...@gmail.com

Jukka K. Korpela

unread,
May 23, 2013, 12:09:02 PM5/23/13
to
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/

Thomas 'PointedEars' Lahn

unread,
May 24, 2013, 4:43:24 AM5/24/13
to
Denis McMahon wrote:

> I tried to do this:
>
> td {padding: inherit 1em}

Syntactically wrong. You can only inherit either no padding or all paddings
with the “padding” property.

> but found that instead I had to do this:
>
> td {padding-left: 1em;padding-right: 1em}

Not equivalent. The initial value for the padding properties is 0, so this
would be equivalent to

td {
padding: 0 1em;
}

provided no other selectors and declarations apply.

> I expected that 'inherit' would apply to individual values of the multi-
> value list, but that doesn't seem to be the case. Does the assembled
> expertise think it should? Firefox 21 / Ubuntu 12.04.2 LTS.

Syntactically, you are looking for

td {
padding: 1em;
padding-top: inherit;
padding-bottom: inherit;
}

or

td {
padding-top: inherit;
padding-right: 1em;
padding-bottom: inherit;
padding-left: 1em;
}

Untested.

<http://www.w3.org/TR/CSS2/box.html#padding-properties>


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300...@news.demon.co.uk> (2004)

Evertjan.

unread,
May 24, 2013, 5:13:38 AM5/24/13
to
Thomas 'PointedEars' Lahn wrote on 24 mei 2013 in
comp.infosystems.www.authoring.stylesheets:

> Syntactically, you are looking for
>
> td {
> padding: 1em;
> padding-top: inherit;
> padding-bottom: inherit;
> }
>
> or
>
> td {
> padding-top: inherit;
> padding-right: 1em;
> padding-bottom: inherit;
> padding-left: 1em;
> }
>
> Untested.

Shorter:

td {
padding: inherit;
padding-right: 2em;
padding-left: 2em;
}

Untested.


And:

padding-right: 1em;
padding-wrong: 1em;

To be tested later, much later.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

David Stone

unread,
May 24, 2013, 9:07:43 AM5/24/13
to
In article <XnsA1CA7235...@194.109.133.133>,
"Evertjan." <exxjxw.h...@inter.nl.net> wrote:
[snip]
>
> And:
>
> padding-right: 1em;
> padding-wrong: 1em;
>
> To be tested later, much later.

Haha!

Meanwhile, I keep reading the subject lines as "inherited pUdding",
and I'm really not sure I want to see that...

Barry Margolin

unread,
May 24, 2013, 4:51:17 PM5/24/13
to
In article <no.email-AE9F8A...@news.eternal-september.org>,
I guess Cosby's children will get that when he dies.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

dorayme

unread,
May 24, 2013, 6:14:01 PM5/24/13
to
In article
<no.email-AE9F8A...@news.eternal-september.org>,
David Stone <no.e...@domain.invalid> wrote:

...
> Meanwhile, I keep reading the subject lines as "inherited pUdding",
> and I'm really not sure I want to see that...

or ever be the recipient of one. <g>

Which reminds me. The comic strip Hagar is made these days without
true wit - the original creator passed away late 1980s. A friend of
mine redoes them regularly, keeping the drawings and photoshopping the
words out and replacing, the result being true wit. Why does it remind
me? Because of his:

<http://dorayme.netweaver.com.au/justPics/iDontWishToKnowThat.png>

(compare with original

<http://www.arcamax.com/thefunnies/hagarthehorrible/s-1325853>

)

There is an almost consistent lack of imagination in the comic from
day to day in the newspapers these days. I'm fairly sure it was
funnier when the original creator was doing it.

This might have been from the original author (who died in 1989)

<http://www.comicartfans.com/gallerypiece.asp?piece=929403>

Not bad!

--
dorayme
0 new messages