gpt4 book ai didi

javascript - css3 悬停在图标和边框上

转载 作者:行者123 更新时间:2023-11-28 09:57:52 25 4
gpt4 key购买 nike

HTML 代码...

          <ul class="social-icon">
<li><a href="#" class="social-facebook">
<i class="fa fa-facebook"></i>
<i class="fa fa-facebook ff"></i>
</a></li>
<li><a href="#" class="social-twitter"><i class="fa fa-twitter"></i></a></li>
<li><a href="#" class="social-google-plus"><i class="fa fa-google-plus"></i></a></li>
<li><a href="#" class="social-dribbble"><i class="fa fa-dribbble"></i></a></li>
<li><a href="#" class="social-linkedin"><i class="fa fa-linkedin"></i></a></li>
<li><a href="#" class="social-rss"><i class="fa fa-rss"></i></a></li>
</ul>

和 CSS 代码..

.social-icon {
text-align: center;
text-decoration: none;
}
.social-icon li {
list-style: none;
display: inline-block;
float: left;
position: relative;
}
.social-icon li a {
display: inline-block;
font-size: 18px;
line-height: 28px;
width: 35px;
text-decoration: none;
outline: none;
height: 36px;
border: 1px solid #000;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.social-icon li a:first-child {
border-left: 1px solid #000;
}
.social-icon li a .ff {
opacity: 0;
-webkit-transform: scale(5);
-moz-transform: scale(5);
-o-transform: scale(5);
-ms-transform: scale(5);
transform: scale(5);
-webkit-transition: all 0.3s ease-in-out 0.2s;
-moz-transition: all 0.3s ease-in-out 0.2s;
-o-transition: all 0.3s ease-in-out 0.2s;
-ms-transition: all 0.3s ease-in-out 0.2s;
transition: all 0.3s ease-in-out 0.2s;
}
.social-icon li a .ff:hover {
opacity: 1;
background-color: #345599;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
-ms-transition-delay: 0.2s;
transition-delay: 0.2s;
}
.social-icon li a i {
color: #d2d2db;
position: absolute;
top: 10px;
left: 10px;
}

问题是当我将鼠标悬停在 Facebook 图标上时,它的背景颜色很少。边框是双边框,我使用 1px 边框。请帮助我...抱歉我的英语不好。

Here is jsFiddle editor link

最佳答案

我认为这更接近你想要的:

.social-icon {
text-align: center;
text-decoration: none;
}
.social-icon li {
list-style: none;
float: left;
position: relative;
height: 38px;
}
.social-icon li a{
display: inline-block;
font-size: 18px;
line-height: 28px;
width: 35px;
text-decoration: none;
outline: none;
height: 36px;
border-right: 1px solid #000;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.social-icon li:first-child {
border-left: 1px solid #000;
}
.social-icon li .ff {
opacity: 0;
-webkit-transform: scale(5);
-moz-transform: scale(5);
-o-transform: scale(5);
-ms-transform: scale(5);
transform: scale(5);
-webkit-transition: all 0.3s ease-in-out 0.2s;
-moz-transition: all 0.3s ease-in-out 0.2s;
-o-transition: all 0.3s ease-in-out 0.2s;
-ms-transition: all 0.3s ease-in-out 0.2s;
transition: all 0.3s ease-in-out 0.2s;
}
.social-icon li .ff:hover {
opacity: 1;
background-color: #345599;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
-ms-transition-delay: 0.2s;
transition-delay: 0.2s;
}

.social-icon li a i {
color: #d2d2db;
position: absolute;
padding: 10px;
top: 0px;
left: 0px;
}

.social-icon .fa-facebook {
padding-right: 15px;
}

编辑:我更新了代码。还是会有.ff的问题对象比 <li> 大得多容器。因此,您将在框外的空间中激活过渡。

关于javascript - css3 悬停在图标和边框上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24833884/

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