hover.html 1.7 KB
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>hover</title>
  <style>
div {
    position: relative;
    width: 200px;
    height: 60px;
    line-height: 60px;
    font-size: 32px;
    cursor: pointer;
    color: #333;
    text-align: center;
    margin-left:40%;
	margin-bottom:16px;
}
.div1{
	margin-top:80px;
}
.div1::before {	
    content: "";
    position: absolute;
    left: 0%;
    bottom: 0;
    width: 200px;
	height: 2px; 
    background: deeppink;
	transition: all .5s;    
	transform: scaleX(0);
	z-index: 2;  
}

.div1:hover::before {
    transform: scaleX(1);
}
.div2::before {
    content: "";
    position: absolute;
    left: 0%;
    bottom: 0;
    width: 200px;
    height: 2px;
    background: deeppink;
    transition: transform .5s;
	transform: scaleX(0);
    transform-origin:100% 0;
} 
.div2:hover::before {
    transform: scaleX(1);
    transform-origin: 0 0;
}

.div3::before {
    content: "";
    position: absolute;
    left: 0%;
    bottom: 0;
    width: 200px;
    height: 20px;
    background: deeppink;
    transition: transform .5s;
	transform: scale(0,0);
    transform-origin:100% 100%;
} 
.div3:hover::before {
    transform: scale(1,1);
    transform-origin: 0 0;
}
.div4::before {
    content: "";
    position: absolute;
    left: 0%;
    bottom: 0;
    width: 200px;
    height: 60px;
    background: deeppink;
    transition: all .5s;	
	transform: scale(0,0); 
	transform-origin: 50% 100%;
	z-index:-1;
} 
.div4:hover{
	color: #fff;
}
.div4:hover::before {   
		transform: scale(1,1);	
		transform-origin: 50% 0;	
}

  </style>
</head>
<body>
<div class="div1">点我</div>
<div class="div2">点我</div>
<div class="div3">点我</div>
<div class="div4">点我</div>
</body>
</html>