gpt4 book ai didi

html - 使颜色在悬停时淡入淡出

转载 作者:太空宇宙 更新时间:2023-11-03 23:13:35 25 4
gpt4 key购买 nike

我的CSS

body {
background-image: url("http://images.virtualworldsland.com/blog/2322/796.jpg");
font-family: Verdana, sans-serif;
}

img {
box-shadow: 0px 3px 12px 2px #000;
}

.rotate {
-webkit-transition: all 0.5s ease-out;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}

.rotate:hover {
-webkit-transform: rotate(-7deg);
-moz-transform: rotate(-7deg);
-o-transform: rotate(-7deg);
}

#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a {
margin: 0;
padding: 0;
border: 0;
list-style: none;
line-height: 1;
display: block;
position: relative;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#cssmenu {
width: 200px;
color: #ffffff;
box-shadow: 0px 3px 12px 2px #000;
position: absolute;
left:0;
margin-top: 150px;
}

#cssmenu > ul > li > a {
padding: 16px 22px;
cursor: pointer;
z-index: 2;
font-size: 16px;
text-decoration: none;
color: #ffffff;
background: #3ab4a6;
-webkit-transition: color .2s ease;
-o-transition: color .2s ease;
transition: color .2s ease;
}

#cssmenu > ul > li > a:hover {
background: #226c63;
}

#cssmenu ul ul li a {
padding: 14px 22px;
cursor: pointer;
z-index: 2;
font-size: 14px;
text-decoration: none;
color: #dddddd;
background: #49505a;
}

我的html

<div align="center">
<img src="Header.png" style="position: absolute; margin-left: -440px;" class="rotate" />
</div>
<p></p>
<div id='cssmenu' class="rotate">
<ul>
<li><a href='#'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Blog</a></li>
<li><a href='#'>Wiki</a></li>
<li><a href='#'>Trivia</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</div>

当有人将鼠标悬停在其中一个 li 上时,它会将背景颜色更改为 #226c63。我如何使这种颜色淡入但不会立即出现。我也希望它淡出。

最佳答案

您的过渡是彩色的。它们的背景应该是这样的:

transition: background .2s ease;

关于html - 使颜色在悬停时淡入淡出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31614639/

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