其他分享
首页 > 其他分享> > 嵌套元素坍塌

嵌套元素坍塌

作者:互联网

<!DOCTYPE html> <html lang="en">
<head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Document</title>     <style>         #dv1 {             width: 200px;             height: 200px;             background-color: #16a085;         }
        #dv2 {             width: 100px;             height: 100px;             background-color: #e67e22;             /* 1.可以为父元素定义上边框             2.可以为父元素定义上内边距             3.可以为父元素添加overflow:hidden */             margin-top: 50px;         }     </style> </head>
<body>     <div id="dv1">         <div id="dv2"></div>     </div> </body>
</html>

标签:width,color,坍塌,元素,100px,height,嵌套,为父
来源: https://www.cnblogs.com/yongerbingxuan/p/14695788.html