【发布时间】:2021-11-02 14:46:05
【问题描述】:
我正在尝试在 css 中用作 background 的图像上添加动画效果。
这是css:
{
color: inherit;
text-decoration: none;
height: 100%;
width: 100%;
display: block;
background: url('http://placehold.it/350x150')no-repeat top center;"
background-size: cover !important;
-webkit-background-size: 100% 100%;
-moz-background-size: 100% 100%;
-ms-background-size: 100% 100%;
transition: all 0.3s ease-in 0s;
-webkit-transition: all 0.3s ease-in 0s;
-moz-transition: all 0.3s ease-in 0s;
-ms-transition: all 0.3s ease-in 0s;
}
a.mf-portfolio-image-container:hover{
background-size: 120% !important;
//transform: grow(1.072, 1.072);
//-webkit-transform: scale(1.072, 1.072);
//-moz-transform: scale(1.072, 1.072);
//-ms-transform: scale(1.072, 1.072);
}
现在,在悬停时,我正在尝试稍微缩放 background-size(生长效果),但它不起作用。
我所拥有的只是背景尺寸增加但没有动画(或者无论如何,平滑缩放)
我读过一些文章,但他们都在谈论这种效果不是应用于background-image,而是应用于 HTML 中的图像。
这是一个快速的fiddle
关于如何正确实现这种效果的任何想法?
【问题讨论】:
标签: css background-image css-transitions