根據標題,您可以看到問題here的演示。使用圓角時,子div不填充父分區
下面是HTML代碼:
<div id="outer">
<div id="inner">
</div>
</div>
這裏是CSS代碼:
#inner{
height: 100%;
width: 100%;
border-radius: 20px;
text-shadow: 5px 5px 5px #000000;
background-color: white;
opacity: 0;
-webkit-transition: opacity .5s linear;
-moz-transition: opacity .5s linear;
transition: opacity .5s linear;
}
#inner:hover{
opacity: 1;
}
#outer{
border: 6px solid #dcc5c5;
border-radius: 20px;
text-shadow: 5px 5px 5px #000000;
position: relative;
display: inline-block;
transition: all 0.5s ease-in-out;
background-color: red;
height: 200px;
width: 200px;
}
您正在使用的margin-top:20px的 – LSKhan
看起來好像沒什麼問題?向#inner添加邊界半徑? –