【发布时间】:2020-11-13 17:32:22
【问题描述】:
有三个问题:
- 如何使黄色圆圈(子 div)在穿过其父红色边框时被修剪,以便我只看到黄色方块? (仅使用 CSS)
- 如何在圆长大时按圆心固定?现在它由左上角固定。
- 如果我使用“位置:固定”然后声明顶部:10px;左:10px;如何将 CSS 过渡添加到“顶部”和“左侧”属性?
.parent {
width: 200px;
height: 200px;
background-color: salmon;
border: 5px solid red;
}
.child {
width: 20px;
height: 20px;
background-color: yellow;
border: 2px solid blue;
border-radius: 50%;
}
.child:active {
width: 350px;
height: 350px;
transition: width 2s linear, height 2s linear;
}
<div class="parent">
<div class="child">
</div>
</div>
【问题讨论】:
标签: css position transition trim