CSS/HTML Left Margin be inherited from the parent Code For Website - Learn About Website | DaddyFile

0

The following example lets the left margin be inherited from the parent element.


Html Code:

<!DOCTYPE html>
<html>
<head>
<style>
div.container {
    border: 1px solid red;
    margin-left: 100px;
}

p.one {
    margin-left: inherit;
}
</style>
</head>
<body>

<h2>Use of the inherit Value</h2>
<p>Let the left margin be inherited from the parent element:</p>

<div class="container">
<p class="one">This is a paragraph with an inherited left margin (from the div element).</p>
</div>

</body>
</html>






Html Code Result:



Post a Comment

 
Top