我想转换按钮但它不起作用?

时间:2021-07-06 10:53:23

标签: css sass css-transitions

.free-btn {
a {
    position: relative;
    .fbtn-bg {
        display: inline-block;
        font-size:20px;
        font-weight: 600;
        color:#000;
        padding:20px 85px;
        background: #f4f4f4;
        border-radius: 14px;
        z-index: 100;
        position: relative;
        transition: all .5s ease-in-out;
        &:hover {
            top:10px;
            right: -10px;
            transition: all .5s ease-in-out;
        }
    }
}

}

我想转换为 buttun,但它不起作用。我的错误在哪里,你能帮帮我吗?

1 个答案:

答案 0 :(得分:1)

你应该使用 translate() 而不是使用 right 和 left。 悬停选择器应如下所示:

:hover {
  transform: translate(10px , 10px);
}