1

I want to clarify the logic behind inheritance.

<div class="classics">
   <h2>Mega</h2>
     <div class="tild">
        <div class="color">
             <div class="medium">
                 <h1>Hello</h1>
             </div>
         </div>
     </div>
 </div>

If I give .classics the style display:inline-block will that apply also apply to the h2 element?

What about font-color?

If I give .tild the styledisplay:flex does that mean .color will also inherit that value?

Vlad274
  • 6,514
  • 2
  • 32
  • 44
  • One thing you can do, is actually test it and see the behavior for yourself. – Ibu May 30 '19 at 20:37
  • (1) test and see (2) read the documentation of each property to see if it's inherited or not – Temani Afif May 30 '19 at 20:38
  • Though the list of heritable attributes in the other answer is worth looking over, it does not fully answer the question, or at least not in an easily digestible manner. Display is not heritable, but children of a display: flex element, though retaining their original display, will behave differently because of their parent's display value. Further, some elements can override heritability, so though font-weight is heritable, it won't be inherited by header elements like the h2 from the question. – wassona May 30 '19 at 20:44

0 Answers0