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
<!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 Explorer | Firefox | Chrome | Safari | Opera | Edge |
---|
8.0 | 1.0 | 1.0 | 1.0 | 4.0 | Yes |