为 2 个不同的浏览器组合相同的 css 样式

combining same css style for 2 different browser

是否可以在不同的浏览器上组合相同的样式。我知道我们可以为不同的标签应用相同的 css 样式,例如

p , span{
background: red;
}

我想为

缩短我的 css 代码
progress::-moz-progress-bar { 
    background:#cbccce;
}
 progress::-webkit-progress-bar {
    background:#cbccce;
}

这是我尝试过的方法,但似乎不起作用。

progress::-moz-progress-bar , progress::-webkit-progress-bar {
    background:#cbccce;
}

我试过搜索,但找不到答案。提前致谢:)

不,您不能将“供应商前缀”组合在一起。

但是您可以使用开发人员工具自动生成它们,例如 autoprefixer 或者您可以使用 CSS 预处理器 SASS LESS 来缩短您的 css代码

What is a CSS preprocessor?

A CSS preprocessor is a scripting language that extends CSS by allowing developers to write code in one language and then compile it into CSS. Sass is perhaps the most popular preprocessor around right now, but other well-known examples include Less and Stylus.