按规则分组css

按规则分组css,css,Css,是否可以删除下面代码中指定的at规则的复制粘贴 animated { animation: expand .7s; -moz-animation: expand .7s; -webkit-animation: expand .7s; -o-animation: expand .7s; } @keyframes expand { from {height: 502px;} to {height: 558px;} } @-moz-keyframes e

是否可以删除下面代码中指定的at规则的复制粘贴

animated {
    animation: expand .7s;
    -moz-animation: expand .7s;
    -webkit-animation: expand .7s;
    -o-animation: expand .7s;
}
@keyframes expand {
    from {height: 502px;}
    to {height: 558px;}
}
@-moz-keyframes expand {
    from {height: 502px;}
    to {height: 558px;}
}
@-webkit-keyframes expand {
    from {height: 502px;}
    to {height: 558px;}
}

我想要一个具有关键帧定义的位置(“从..到..”代码)

不,不能按规则分组

这就是前缀规则的缺点:必须根据需要为每个前缀重复值

您可以使用诸如Sass或更少的预处理器来提供mixin功能,编写一个生成所有前缀规则的mixin,并在整个样式表中使用该mixin,它将为您编译适当的CSS at规则。但是,如果不重复这些值,就不能使用CSS对前缀为at的规则进行分组。

一旦开始编写更少的内容(或SCS)并开始编译最终的CSS,您就再也不会返回了(这使语言变得更干净)