效果图:
20200603.gif
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body,
html {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
}
.text {
padding: 20px 70px;
font-size: 20px;
font-weight: bold;
border: 2px solid black;
letter-spacing: 0.5rem;
cursor: pointer;
user-select: none;
}
.text:hover {
animation: text 0.2s linear infinite alternate;
}
@keyframes text {
25% {
filter: drop-shadow(5px 5px 0px rgb(0, 81, 255));
}
75% {
filter: drop-shadow(-4px -5px 0px rgb(247, 0, 255));
}
85%{
filter: drop-shadow(5px -3px 0px rgb(255, 238, 0));
}
}
</style>
</head>
<body>
<div class="text">抖动</div>
</body>
</html>
网友评论