关于逗号分隔的css类,我有一个奇怪的问题。 Firefox会忽略以下类.Control-fakeSelect::after
: - See result
.Control-field::-webkit-calendar-picker-indicator,
.Control-fakeSelect::after{
background-color: transparent; /* 1 */
background-image: url("data:image/svg+xml;utf8,%3Csvg%20width%3D%2215%22%20height%3D%229%22%20viewBox%3D%220%200%2015%209%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cg%20fill%3D%22%23444%22%3E%3Cpath%20d%3D%22M11.773.583L7.38%204.976%202.987.583C2.432.028%201.532.028.977.583c-.555.555-.555%201.455%200%202.01L6.374%207.99c.28.278.642.417%201.006.417.09%200%20.182-.01.27-.026.27-.05.526-.18.734-.39l5.4-5.397c.554-.555.554-1.455%200-2.01-.556-.555-1.456-.555-2.01%200z%22%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E");
background-position: center right;
background-repeat: no-repeat;
color: transparent; /* 1 */
content: "";
cursor: pointer;
height: 15px;
line-height: 15px;
margin-top: 2px;
opacity: 1; /* 1 */
padding: 10px 0 10px 20px;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 15px;
}
但是,如果我从逗号分隔列表中删除.Control-field::-webkit-calendar-picker-indicator
,那么css看起来像这样:
.Control-fakeSelect::after{
background-color: transparent; /* 1 */
background-image: url("data:image/svg+xml;utf8,%3Csvg%20width%3D%2215%22%20height%3D%229%22%20viewBox%3D%220%200%2015%209%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cg%20fill%3D%22%23444%22%3E%3Cpath%20d%3D%22M11.773.583L7.38%204.976%202.987.583C2.432.028%201.532.028.977.583c-.555.555-.555%201.455%200%202.01L6.374%207.99c.28.278.642.417%201.006.417.09%200%20.182-.01.27-.026.27-.05.526-.18.734-.39l5.4-5.397c.554-.555.554-1.455%200-2.01-.556-.555-1.456-.555-2.01%200z%22%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E");
background-position: center right;
background-repeat: no-repeat;
color: transparent; /* 1 */
content: "";
cursor: pointer;
height: 15px;
line-height: 15px;
margin-top: 2px;
opacity: 1; /* 1 */
padding: 10px 0 10px 20px;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 15px;
}
Firefox识别css类。 See result
之前有任何人遇到此问题或者知道为什么Firefox在添加到逗号分隔的css类时会忽略::?
答案 0 :(得分:2)
此行为是正确且有意的。您的选择器是:
.Control-field::-webkit-calendar-picker-indicator,
.Control-fakeSelect::after
由于Firefox不能(不会)解析第一个,因为它的供应商特定,它认为整个规则原子无效,因为它不知道如何完全适用它。 IE和Edge也会这样做。
所以你的观察是错误的,它与:after
或逗号没有关系,它与-webkit
前缀有关,而且是故意的按规格正确的行为。将规则拆分为2,它将正常工作。