父元素div背景为白色并设置了圆角和溢出隐藏,子元素是一张图片,在圆角位置会有白边,怎么解决啊?-灵析社区

七安前

这样加个伪类把: div { width: 1280px; height: 720px; border-radius: 36px; position: relative; overflow: hidden; } div::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #fff; border-radius: 40px; } img { width: 100%; height: 100%; transition: 250ms; position: relative; z-index: 2; border-radius: 36px; } img:hover { transform: scale(1.2); } ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241010/d9c80cb583e2cd2f82933cedee82a2e5.png)

阅读量:1

点赞量:0

问AI