怎樣使絕對定位的子元素鋪滿父元素而且子元素能夠設置padding

<!DOCTYPE html>
<html>
<head lang="en">
   <meta charset="UTF-8">
   <title></title>
   <style>
       .outer{
           width: 500px;
           height: 500px;
           background-color: green;
           position: relative;
       }
       .inner{
           position: absolute;
           padding: 10px;
           top: 0px;
           right: 0px;
           bottom: 0px;
           left: 0px;
           background-color: orangered;
       }
   </style>
</head>
<body>
<div class="outer">
   <div class="inner"></div>
</div>
</body>
</html>

相關文章
相關標籤/搜索