Home > DeveloperSection > Forums > Inheritance in CSS
Hank Greenberg
Hank Greenberg

Total Post:12

Points:84
Posted on    June-14-2013 9:18 AM

 CSS-CSS3 CSS-CSS3 
Ratings:


 1 Reply(s)
 690  View(s)
Rate this:
Hi Developers,

What is meaning of inheritance in CSS terminology? Can you provide any example for better understanding!

Your help is greatly appreciated.


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-15-2013 5:15 AM


Some styles, like font family, text-alignment etc., are automatically inherited by child elements from their parent element (i.e. by an element contained inside another one).

Others are not automatically inherited.

Example

<div style=”font-family:serif; border:1px solid red; padding:10px;”>

This text will be in a serif font.
 <p>
 This text is also in a serif font, because font is inherited by default.
 But the border and padding properties are not inherited from the parent div.
 </p>

</div>


Don't want to miss updates? Please click the below button!

Follow MindStick