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>





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>





Click to Enlarge


Browser support


Internet ExplorerFirefoxChromeSafariOperaEdge
8.01.01.01.04.0Yes



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

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250