源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> div.container { border: 1px solid red; margin-left: 100px; } p.one { margin-left: inherit; } </style> </head> <body> <h2>使用inherit值</h2> <p>让左边距从父元素继承:</p> <div class="container"> <p class="one">这是一个继承父元边距的素段落.</p> </div> </body> </html>
运行结果