agansj

可以通过JS实现 $(this).find("span").css(\'color\',\'red\');方式更改,通过CSS更改也是可以的

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
        div {
        	width:500px;height:500px;background:pink;position: relative;
        }        
        span {
        	width:100px;height:100px;display:block;position: absolute;top:100px;left:100px;
        	background:#ddd;
        	transition:1s;
        }      
        div a:hover span {
        	background-color: #777;
        }
        div a {
        	color:red;
        	transition:1s;
        }
        div a:hover {
        	color:#000;
        }
	</style>
</head>
<body>
	<div>
		<a href="#">
			<span></span>
			BACK TO TOP
		</a>	
	</div>
</body>
</html>

  

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2021-07-24
  • 2021-08-23
猜你喜欢
  • 2021-10-20
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2021-08-06
  • 2022-12-23
相关资源
相似解决方案