CSS自定义属性在Chrome中不起作用 [英] CSS Custom Properties not working in Chrome

查看:207
本文介绍了CSS自定义属性在Chrome中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有以下CSS自定义属性,如下所示:

I have the following CSS Custom property set like follows:

:root {
  --login-top: 20px;
}

在CSS中,我在以下位置使用它:

In the CSS I use this in the following places:

@keyframes loginformstart{
    from {top:200px;}
    to  {top: var(--login-top);}
}

.login_form_hide
{
    display:block;
    position:absolute;
    top: var(--login-top);
    animation-name: loginformhide;
    animation-duration: 0.3s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out;
}

这在Firefox中效果很好,但在Chrome中效果不佳.我在做错什么吗?

This works great in Firefox but not in Chrome. Am I doing something wrong?

来源: W3C

推荐答案

根据 MDN规范,Firefox是当前唯一支持CSS变量的浏览器.

According to the MDN spec, Firefox is the only browser that currently supports css variables.

这篇关于CSS自定义属性在Chrome中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆