cssinheritance

Which CSS properties are inherited?


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?


Solution

  • Here is the list of all inheritable properies. I'm working with W3C's information (updated for CSS 2.1), so I'd guess it should be correct. But knowing web browsers (IE specifically), some of these might not be inheritable by all browsers:

    1. azimuth
    2. border-collapse
    3. border-spacing
    4. caption-side
    5. color
    6. cursor
    7. direction
    8. elevation
    9. empty-cells
    10. font-family
    11. font-size
    12. font-style
    13. font-variant
    14. font-weight
    15. font
    16. letter-spacing
    17. line-height
    18. list-style-image
    19. list-style-position
    20. list-style-type
    21. list-style
    22. orphans
    23. pitch-range
    24. pitch
    25. quotes
    26. richness
    27. speak-header
    28. speak-numeral
    29. speak-punctuation
    30. speak
    31. speech-rate
    32. stress
    33. text-align
    34. text-indent
    35. text-transform
    36. visibility
    37. voice-family
    38. volume
    39. white-space
    40. widows
    41. word-spacing