Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 缩放:在悬停之前_Css_Animation_Hover_Scale - Fatal编程技术网

Css 缩放:在悬停之前

Css 缩放:在悬停之前,css,animation,hover,scale,Css,Animation,Hover,Scale,我正试图在将鼠标悬停在上时缩放:before我的内容。到目前为止,当鼠标悬停时会应用样式,但没有视觉变化,因此:before的缩放比例保持不变 到目前为止,我得到的是: Icomoon: 不要使用“缩放”属性对其进行变换,而是使用字体大小。因此: .icon-ico-heart:hover:before { font-size: 20px; } 不要使用“缩放”属性对其进行变换,而是使用字体大小。因此: .icon-ico-heart:hover:before { font-s

我正试图在将鼠标悬停在
上时缩放
:before
我的
内容。
到目前为止,当鼠标悬停时会应用样式,但没有视觉变化,因此
:before
的缩放比例保持不变

到目前为止,我得到的是:

Icomoon:


不要使用“缩放”属性对其进行变换,而是使用字体大小。因此:

.icon-ico-heart:hover:before {
    font-size: 20px;
}

不要使用“缩放”属性对其进行变换,而是使用字体大小。因此:

.icon-ico-heart:hover:before {
    font-size: 20px;
}

增加悬停时的
字体大小
,并向其添加
transition
属性

.icon-ico-heart:before {
    font-size: 10px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.icon-ico-heart:hover:before {
    font-size: 15px;
}

您只需使用
transition:font 0.3s ease
仅对字体应用转换,而不是
all

增加悬停时的
font size
,并向其添加
transition
属性

.icon-ico-heart:before {
    font-size: 10px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.icon-ico-heart:hover:before {
    font-size: 15px;
}

您只需使用
transition:font 0.3s ease
若要仅对字体而不是所有字体应用转换,您可能无法对字体或图标字体使用缩放属性


除此之外,您可以使用字体大小属性。

您可能无法对字体或图标字体使用缩放属性


您可以使用font-size属性来代替它。

您不能转换
::before
元素,因为它的显示类型是:
display:inline
, 您必须将其更改为
display:inline block
或其他

。图标ico心脏:之前{
内容:“\e914”;
显示:内联块;
}

您无法转换
::before
元素,因为它的显示类型是:
显示:内联
, 您必须将其更改为
display:inline block
或其他

。图标ico心脏:之前{
内容:“\e914”;
显示:内联块;
}

谢谢,这很有效!对于未来的观众:您必须将转换放在
:before
上。问题是如何缩放::before,而不是如何更改字体大小。谢谢您!对于未来的观众:您必须将转换放在
:before
上。问题是如何缩放::before,而不是如何更改字体大小。
.icon-ico-heart:before {
    font-size: 10px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.icon-ico-heart:hover:before {
    font-size: 15px;
}