带有边缘的CSS问题


.background-red {
background-color: #ff6767d4;
}

在Microsoft Edge(而不是Chromium(上,此颜色未正确渲染。如果是Edge ,我如何使用CSS来使用以下内容

.background-red {
background-color: red;
}

您只需编写:

.background-red {
background-color: red;
background-color: #ff6767d4;
}

将使用最后一个工作值。如果浏览器不理解某个值,它将回退到它所理解的最后一个值。

编辑:你也可以使用rgba()来定义你的颜色,据我所知,edge支持这种格式。

基于这个答案和canouseit表IE不支持带alpha通道的十六进制值。这就是为什么它忽略了整个规则。

若要应用无效值,必须为其设置回退。请注意顺序-遇到无效值时,浏览器将使用最后一条已知规则。

.background-red {
background-color: rgba(255, 103, 103, .83);
background-color: #ff6767d4;
}

最新更新