Articles → CSS → CSS Inherit Keyword

CSS Inherit Keyword






Purpose





Syntax


Css-property-name:inherit;



Example




<!DOCTYPE html>
<html>
	<head>
		<title></title>
		<style>
       div {
           color:red;
       }
       p {
           color:black;
       }    
   </style>
	</head>
	<body>
		<div>
        This is a div
       
			<p>
           This is the test paragraph
       </p>
		</div>
	</body>
</html>




Picture showing the output of the css inherit keyword
Click to Enlarge



p {
           color:black;
       }




<!DOCTYPE html>
<html>
	<head>
		<title></title>
		<style>
        div {
            color: red;
        }

        p {
            color: black;
        }
    </style>
	</head>
	<body>
		<div>
        This is a div
        
			<p style="color:inherit;">
            This is the test paragraph
        </p>
		</div>
	</body>
</html>




Picture showing the output of the css inherit keyword
Click to Enlarge


Browser Support


Internet ExplorerFirefoxChromeSafariOperaEdge
8.01.01.01.04.0Yes



Posted By  -  Karan Gupta
 
Posted On  -  Saturday, November 4, 2017

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250