Home
CSS
CSS Margins
Tryit: Using the inherit value
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> div { border: 1px solid red; margin-left: 100px; } p.ex1 { 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> <p class="ex1">This paragraph has an inherited left margin (from the div element).</p> </div> </body> </html>