gpt4 book ai didi

html - css 悬停动画在 icomoon 中不起作用

转载 作者:行者123 更新时间:2023-12-04 15:26:15 24 4
gpt4 key购买 nike

我有带有 css3 悬停动画的菜单(toTopFromBottom)。现在我需要将 fontawesome 图标更改为 icomoon 图标并添加此效果:

HTML:

<div id="top-bar" class="top-bar">
<div class="container">
<div class="col-md-12">
<div class="row">
<div class="social-icons social-icons-colored-hover">
<ul>
<li class="social-facebook"><a href="#"><i class="icon-mug"></i></a></li>
<li class="social-twitter"><a href="#"><i class="icon-rocket"></i></a></li>
<li class="social-google"><a href="#"><i class="icon-paint-format"></i></a></li>
<li class="social-vimeo"><a href="#"><i class="icon-pencil"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>

CSS:

#top-bar .social-icons {
float: right;
height: 100%;
overflow: hidden;
}
#top-bar .social-icons li,
#top-bar .social-icons li a {
float: left;
list-style: outside none none;
}
#top-bar .social-icons li a {
border-radius: 0px;
border-right: 1px solid rgba(180, 180, 180, 0.2);
font-size: 15px;
height: 40px;
line-height: 40px;
text-align: center;
width: 35px;
overflow: hidden;
margin: 0;
}
#top-bar .social-icons li:first-child a {
border-left: 1px solid rgba(180, 180, 180, 0.2);
}
.social-icons ul {
padding: 0;
}
.text-center.social-icons ul {
display: inline-block;
}
.social-icons li {
float: left;
list-style: none;
}
.social-icons li a {
float: left;
height: 32px;
width: 32px;
line-height: 32px;
font-size: 16px;
text-align: center;
margin: 0 8px 8px 0;
border-radius: 4px;
border: 0;
background: transparent;
color: #565b73;
overflow: hidden;
}
/*Colored*/

.social-icons.social-icons-colored a,
.social-icons.social-icons-colored-hover a:hover {
color: #fff;
border: 0;
}
.social-icons.social-icons-colored .social-facebook a,
.social-icons.social-icons-colored-hover .social-facebook a:hover {
background-color: #5d82d1;
}
.social-icons.social-icons-colored .social-twitter a,
.social-icons.social-icons-colored-hover .social-twitter a:hover {
background-color: #40bff5;
}
.social-icons.social-icons-colored .social-vimeo a,
.social-icons.social-icons-colored-hover .social-vimeo a:hover {
background-color: #35c6ea;
}
.social-icons.social-icons-colored .social-google a,
.social-icons.social-icons-colored-hover .social-google a:hover {
background-color: #eb5e4c;
}
/* Border */

.social-icons.social-icons-border li a {
border: 1px solid #eee;
background: transparent;
color: #333;
}
.social-icons:not(.social-icons-colored):not(.social-icons-colored-hover)
li
a:hover {
background-color: #eee;
}
.social-icons li:hover i {
-webkit-animation: toTopFromBottom 0.3s forwards;
-moz-animation: toTopFromBottom 0.3s forwards;
animation: toTopFromBottom 0.3s forwards;
}
@-webkit-keyframes toTopFromBottom {
49% {
-webkit-transform: translateY(-100%);
}
50% {
opacity: 0;
-webkit-transform: translateY(100%);
}
51% {
opacity: 1;
}
}
@-moz-keyframes toTopFromBottom {
49% {
-moz-transform: translateY(-100%);
}
50% {
opacity: 0;
-moz-transform: translateY(100%);
}
51% {
opacity: 1;
}
}
@keyframes toTopFromBottom {
49% {
transform: translateY(-100%);
}
50% {
opacity: 0;
transform: translateY(100%);
}
51% {
opacity: 1;
}
}

但实际上 css 效果不适用于 icomoon。

Demo With icomoon HERE(not work)

Demo With fontawesome HERE(work true)

最佳答案

试试display: inline-block

[class^="icon-"],
[class*=" icon-"] {
display: inline-block
font-family: "icomoon";
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;

/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

Working demo

关于html - css 悬停动画在 icomoon 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62189323/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com