子div填充整个父div - css

小蕊 发表于: 2019-07-08   最后更新时间: 2021-09-18 09:13:23  
{{totalSubscript}} 订阅, 2,530 游览
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1">
    <title>Document</title>
    <style>
    body {
        width: 200px;
        height: 200px;
    }
    .parent {
        width:100%;
        height: 100%;
        background-color: pink;
    }
    .child {
        width:100%;
        height:100%;
        background-color: yellow;
        position: relative;
    }
    </style>
</head>
<body>
    <div class="parent"> this is parent
        <div class="child"> this is child</div>
    </div>
</body>
</html>

在线运行

css
更新于 2021-09-18

查看css更多相关的文章或提一个关于css的问题,也可以与我们一起分享文章