html - 为什么div转换时我的字体颜色会改变?

标签 html css

这也是 jsfiddle 上的 https://jsfiddle.net/phmttrsh/

#btn {
    font-size: 16px;
    height: 34px;
    width: 120px;
    border: 1px solid #20ACB3;
    text-align: center;
    line-height: 34px;
    background-color: #20ACB3;
    color: #ffffff;
    border-radius: 5px;
    transition: transform 200ms cubic-bezier(0.25, 0.39, 0.39, 2.01);
}

 #btn:hover {
        cursor: pointer;
        transform: scale(1.05);
    }
<div id="btn">Click</div>

当鼠标悬停在按钮上时,字体颜色也会在很短的时间内发生变化,并且只发生在 safari 上。

为什么会发生这种情况?

最佳答案

#btn {
    font-size: 16px;
    height: 34px;
    width: 120px;
    border: 1px solid #20ACB3;
    text-align: center;
    line-height: 34px;
    background-color: #20ACB3;
    color: #ffffff;
    border-radius: 5px;
    -webkit-transition : transform 200ms cubic-bezier(0.25, 0.39, 0.39, 2.01) , color 200ms; 
   -moz-transition : transform 200ms cubic-bezier(0.25, 0.39, 0.39, 2.01) , color 200ms;
    -o-transition : transform 200ms cubic-bezier(0.25, 0.39, 0.39, 2.01) , color 200ms; 
    transition : transform 200ms cubic-bezier(0.25, 0.39, 0.39, 2.01) , color 200ms; 
}

 #btn:hover {
        cursor: pointer;
        transform: scale(1.05);
        color:#fff
    }
<div id="btn">Click</div>

关于html - 为什么div转换时我的字体颜色会改变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39942210/

相关文章:

javascript - 单击按钮不起作用时运行 javascript 脚本

javascript - Css3 - 移除类的过渡

css - 是否可以将除 img 之外的整个页面转换为灰度?

html - 如果我想隐藏我的文本区域,我该怎么做?

html - 无法设法使装载机居中

php - 为每次提交创建一个新页面 - PHP 错误

javascript - 如何在 Jquery 中将 li 类更改为 li id

css - 边距对齐因不同的分辨率而损坏

javascript - 如果嵌套列表中有另一个类,jQuery 添加和删除类和 css

html - CSS/Javascript 下拉菜单水平而非垂直