CSS 3 - Scale transition snaps back in google chro

2019-07-04 11:07发布

I have an issue , I have the following code I am using for increasing the scale using CSS3 transition , at the end it snaps back to its original scale after increasing.

CSS:

.big{


        transition:all 0.3s ease-in-out;
        display:inline;
}
.big:hover{

-webkit-transform:scale(1.4);
}

HTML :

<h1 class = "big">Typo</h1>

1条回答
你好瞎i
2楼-- · 2019-07-04 11:42

Try using inline-block instead of inline (also, it's recommended to add compatibility to the rest of the browsers as well).

CSS:

.big {
    -webkit-transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
    display: inline-block;
}
.big:hover {
    -webkit-transform: scale(1.4);
    -moz-transform: scale(1.4);
    -o-transform: scale(1.4);
    transform: scale(1.4);
}

HTML:

<h1 class="big">Typo</h1>

Test it here: http://jsfiddle.net/XbUC8/

查看更多
登录 后发表回答