对 CSS3 关键帧进行分组
我意识到我不能通过逗号 @keyframes mymove、@-moz-keyframes mymove 等分隔来简单地完成下面相同的代码。
。为了让它们工作,我需要分别声明它们,如下所示。
有什么方法可以将它们分组并使代码更短吗?
@keyframes mymove
{
from {top:0px;}
to {top:200px;}
}
@-moz-keyframes mymove /* Firefox */
{
from {top:0px;}
to {top:200px;}
}
@-webkit-keyframes mymove /* Safari and Chrome */
{
from {top:0px;}
to {top:200px;}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,我不这么认为,但你可以使用 CSS 语言(又名 CSS 预处理器),如 SASS/SCSS/LESS/... - 输出 (CSS) 仍然是相同的,但更改某些内容会容易得多!
查看
如果您有兴趣 - 努力安装和设置它们是完全值得的!
编辑:使用 SCSS 我做了以下操作:
用法示例:
虽然应该补充一点,您需要最新的预发布的 SASS 才能嵌套规则(我们在另一个“{”规则中有一个“{”。 .)所以你应该更新运行“gem install sass --pre”这应该让你“sass-3.2.0.alpha.104”
no, I don't think so, but you could use a CSS language (aka CSS preprocessor) like SASS/SCSS/LESS/... - the output (CSS) would still be the same, but changing something would be much easier!
Check out
if you're interested - the effort of installing them and setting them up is totally worth it!
EDIT: Using SCSS I did the following:
example of usage:
Although it should be added that you need the latest pre-release of SASS to be able to nest rules (we have got a "{" inside another "{" rule...) so you should update run "gem install sass --pre" which should get you "sass-3.2.0.alpha.104"