The Developer Brains


CSS3 INHERITANCE

Web Designing | Web Development


SEE MORE














What is Inheritance?




In CSS3 Inheritance is used to inherit the CSS property be the Child element from it's parent element. separated by a colon.


SEE MORE























</Inheritance Property>


Inheritance

If we apply some CSS properties on the parent elements then the child elements inherit most of the properties of their parent elements, unless some CSS rules overrides that properties. The property in which a child element inherits its parent element's CSS properties called inheritance.

	
<style>
	/*parent element*/
	.parent-tdb{
	color:green;
	font-size:20px;
	}
	/*child element*/
	.child-tdb{
	font-size:10px
	}
</style>
	
	

Here in the above code the child class "child-tdb" inherit the color property but not the font-size (override) CSS property from its parent element



	

<head>
<style>
	.parent-tdb{
	color:green;
	font-size:20px;
	}
	.child-tdb{
	font-size:10px
	}
</style>
</head>

<body>
	<div class="parent-tdb">TDB Tutorials
	<h1 class="child-tdb">
	This is a child class</h1>
	</div>

</body>




Try it Yourself




















In inheritance a child element inherits its parent element's CSS properties.
1. true
2. false




Check Now



CSS3 QUIZ







Next: CSS3 Vertical-Centering


Previous

      

Next Page













  Share TDB SCHOOL  

Share this E-Learning Website on social media platforms with your friends and followers