鼠標放上去 ,其他元素變化顏色 字體 背景顏色


可以通過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>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM