Which CSS properties are inherited?
33,821
Solution 1
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
Solution 2
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
Solution 3
- 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
Related videos on Youtube
Author by
Bogdan Verbenets
Updated on January 29, 2020Comments
-
Bogdan Verbenets about 4 years
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?
-
Undefitied over 7 yearsYou can also set inherit by yourself to any property, i.e. width: inherit;
-
-
Blender about 13 yearsDid you just copy this over from my answer?
-
Shaz about 13 years@Blender: Nope, I found a slide from http://www.slideshare.net..css-inheritance It was listed as a source before you even posted. :)
-
Blender about 13 yearsBut you originally had an image. Oh well.
-
Shaz about 13 years@Blender: Yes, I transferred it to text. I didn't copy/paste yours. No worries.
-
Déjà vu over 7 years@Blender note that this answer has
text-index
that should betext-indent
. -
Joseph Webber over 5 yearsThe accepted answer has a link to the exact same resource.
-
Panu Logic over 5 yearsI 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.
-
Joseph Webber over 5 yearsIf an answer can be improved upon, leave a comment on it saying what you would improve or edit it yourself.
-
Panu Logic over 5 yearsI 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.