::after 1px 间隔线在 Safari 显示颜色不同于其它的问题

8次阅读

共计 468 个字符,预计需要花费 2 分钟才能阅读完成。

前言
在一个菜单面板的时候,把间隔线设置成了 1 绝对像素,生成的效果是下面这样的,在一个线跟其它的不一样。但在 Chrome 上就不会出现这问题。
width: 100%;
bottom: 0;
left: 0;
content: ”;
display: block;
border-bottom: 1px solid #8E8E93;
position: absolute;
transform-origin: 0 100%;
transform: scaleY(0.5);

解决
细找问题,找出来了,我在 ::after 内写的是 border-bottom,也就是说,在纵向压缩的时候,压缩的是 border。换成用 background-color,也就是用 after 的主体。
width: 100%;
bottom: 0;
left: 0;
content: ”;
display: block;
background-color: #8E8E93;
height: 1px;
position: absolute;
transform-origin: 0 100%;
transform: scaleY(0.5);
完成

对比

正文完
 0