CSS 技巧:将盒子宽度和高度缩小到 0 的效果 - 亲自体验!
.box {
width: 100px;
height: 100px;
background-color: red;
transition: all 1s;
}
.box:hover {
width: 0;
height: 0;
}
当将盒子的'width' 和 'height' 同时缩小至 0 时,盒子将完全消失,不再占据任何空间。这是因为,当 'width' 和 'height' 都为 0 时, 盒子的内容区域也会变成 0,因此盒子就不再存在了。
原文地址: https://www.cveoy.top/t/topic/l5pE 著作权归作者所有。请勿转载和采集!