<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
body {
background-color: #f5f5f5;
width: 100%;
height: 100%;
}
div {
text-align: center;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.test {
width: 200px;
height: 200px;
background-color: #ffffff;
float: left;
list-style: none;
text-align: center;
margin: 13px 12px 0 0;
position: relative;
transition: all .2s linear;
top: 0;
}
.test:hover {
top: -5px;
box-shadow: 5px 5px 5px 5px #e4e4e4;
}
</style>
<body>
<div>
<div class="test">
鼠标悬停悬浮
</div>
</div>
</body>
</html>
悬停前:
悬停后: