Style Cascade and Inheritance part 2


Style Cascade and Inheritance
25
2/2












Inheritance
Inheritance refers to the way properties flow through the page. A child element will usually take on the characteristics of the parent element unless otherwise defined.
For example:<html>
<head>
<style>
body {
color: green;
font-family: Arial;
}
</style>
</head>
<body>
<p>
This is a text inside the paragraph.
</p>
</body>
</html>
Result:
Since the paragraph tag (child element) is inside the body tag (parent element), it takes on any styles assigned to the body tag.
Comments
Post a Comment