I've noticed that some properties are inherited in CSS, and some are not. For example, the text-size property is inherited, but the padding and margin are not inherited by the child blocks. So how to figure out which properties are inherited, and which are not?
-
3You can also set inherit by yourself to any property, i.e. width: inherit; – Undefitied Sep 14 '16 at 11:52
4 Answers
Here is the list of all inheritable properies. I'm working with W3C's information, so I'd guess it should be correct. But knowing web browsers (IE specifically), some of these might not be inheritable by all browsers:
azimuth
border-collapse
border-spacing
caption-side
color
cursor
direction
elevation
empty-cells
font-family
font-size
font-style
font-variant
font-weight
font
letter-spacing
line-height
list-style-image
list-style-position
list-style-type
list-style
orphans
pitch-range
pitch
quotes
richness
speak-header
speak-numeral
speak-punctuation
speak
speech-rate
stress
text-align
text-indent
text-transform
visibility
voice-family
volume
white-space
widows
word-spacing
-
12Is there any rule of thumb that could be applied to this list? Do the properties have anything in common? – Kaivosukeltaja Apr 10 '11 at 14:46
-
Many of them are for speech, others are for lists and tables. They're kind of random, but have some vague correlation. – Blender Apr 10 '11 at 14:48
-
5@Kaivosukeltaja One rule of thumb that I feel is there- Anything that is done indefinitely will not cause the page to be grabled. Padding indefinitely would cause the depeest element to be have very small space left. Same for margin. – 0fnt Mar 08 '15 at 04:55
-
5Note that the "Inherited" column in that table, as well as each propdef, refers to whether the property is inherited *by default* without the author having to specify the `inherit` value. The `inherit` value can be used to force any property to inherit, including ones where "Inherited" is listed as no. – BoltClock May 22 '15 at 02:28
-
1@TxRegex: You're welcome to edit my answer as you see fit. I don't really keep track of all the changes. – Blender Mar 27 '18 at 20:12
-
1To Kaivosukeltaja, the answer has a link to https://www.w3.org/TR/CSS21/propidx.html which has all the information in the answer in a concise way and more. It has column named :Media Groups" which should answer your (follow-up) question. – Panu Logic Sep 06 '18 at 14:29
-
It's worth noting that the CSS Speech properties are deprecated (`azimuth`, `elevation`, `pitch-range`, `pitch`, `richness`, `speak-header`, `speak-numeral`, `speak-punctuation`, `speak`, `speech-rate`, `stress`, `voice-family`, and `volume`). Firefox has already dropped support for these properties. – CITguy Jul 09 '19 at 17:43
-
-
1
-
In my actual experience, I feel that most of the attributes related to fonts will be inherited. – weiya ou Oct 28 '21 at 15:39
Blender's and Shaz's lists both enumerate all the inherited CSS 2.1 properties, including those for aural media such as azimuth
. Here below is a list without the aural-oriented properties, now including CSS3 properties.
border-collapse
border-spacing
caption-side
color
cursor
direction
empty-cells
font-family
font-size
font-style
font-variant
font-weight
font-size-adjust
font-stretch
font
letter-spacing
line-height
list-style-image
list-style-position
list-style-type
list-style
orphans
quotes
tab-size
text-align
text-align-last
text-decoration-color
text-indent
text-justify
text-shadow
text-transform
visibility
white-space
widows
word-break
word-spacing
word-wrap

- 307
- 1
- 15

- 1,168
- 11
- 11
-
I'd be good to update this to modern CSS rather than the css 2.1 spec. – Paul Irish Aug 03 '15 at 16:18
-
To Vincent Tang: See my answer it probably comes from https://www.w3.org/TR/CSS21/propidx.html. Never mind that some anonymous person already downvoted it immediately (without explanation or comment). This link is the best reference I can find. If anybody has a better one I'd love to see it. – Panu Logic Sep 06 '18 at 14:13
- azimuth
- border-collapse
- border-spacing
- caption-side
- color
- cursor
- direction
- elevation
- empty-cells
- font-family font-size
- font-style
- font-variant
- font-weight
- font
- letter-spacing
- line-height
- list-style-image
- list-style-position
- list-style-type
- list-style
- orphans
- pitch-range
- pitch quotes
- richness
- speak-header
- speak-numeral
- speak-punctuation
- speak
- speech-rate
- stress
- text-align
- text-indent
- text-transform
- visibility
- voice-family
- volume
- white-space
- widows
- word-spacing

- 15,637
- 3
- 41
- 59
-
4
-
6@Blender: Nope, I found a slide from [http://www.slideshare.net..css-inheritance](http://www.slideshare.net/maxdesign/css-inheritance-a-simple-stepbystep-tutorial?from=ss_embed) It was listed as a source before you even posted. :) – Shaz Apr 10 '11 at 14:32
-
-
1@Blender: Yes, I transferred it to text. I didn't copy/paste yours. No worries. – Shaz Apr 10 '11 at 14:34
-
@Blender note that this answer has `text-index` that should be `text-indent`. – Déjà vu Oct 18 '16 at 04:36
The best reference-page to answer this and similar questions (say which CSS properties are NOT inherited) I've found is:
https://www.w3.org/TR/CSS21/propidx.html
It has a column for "inherited" (or not).
The page says "Several Sections of this specification have been updated". But I can't find a more up-to-date version of this anywhere, listing all CSS properties in a single concise table. But this table I think is great, just what I was looking for. Answers also the question of what are the possible values for each CSS-property, and the initial (= default) value.
If you want to see all inherited or non-inherited properties grouped together you could copy the text from the web-page and insert it into Excel etc. then sort it based on the column "Inherited?". It works I tried it.

- 2,193
- 1
- 17
- 21
-
-
1I see the link now but it does not really really tell you that is the place to go to look up the authoritative answer for yourself. It merely says "I'm working WITH W3C's information". Rather than "working with" it's more like "I copied my list from this official resource". It's useful to point out for the readers that that is the source from which they can find out the exact same information for themselves and possibly more up-to-date information. Just because an answer has been "accepted" doesn't mean it can not be improved upon. – Panu Logic Sep 06 '18 at 14:20
-
If an answer can be improved upon, leave a comment on it saying what you would improve or edit it yourself. – Joseph Webber Sep 06 '18 at 15:20
-
1I think it is better to give a separate alternative answer when you think you have a better one, the original author might be offended if you point out you think there is something "wrong" with their answer. And there's too much negativity on Stack Overflow already. – Panu Logic Sep 06 '18 at 18:52