<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3 动画按钮</title>
<style>
body {
font-family: 'Arial', sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f5f5f5;
margin: 0;
}
.button-container {
text-align: center;
}
.animated-button {
position: relative;
display: inline-block;
padding: 15px 30px;
color: #fff;
background: linear-gradient(45deg, #ff3366, #ba265d);
border: none;
border-radius: 50px;
font-size: 18px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
cursor: pointer;
overflow: hidden;
box-shadow: 0 5px 15px rgba(186, 38, 93, 0.4);
transition: all 0.3s ease;
}
.animated-button:hover {
transform: translateY(-3px);
box-shadow: 0 8px 20px rgba(186, 38, 93, 0.6);
}
.animated-button:active {
transform: translateY(1px);
}
.animated-button::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
transition: 0.5s;
}
.animated-button:hover::before {
left: 100%;
}
.animated-button span {
position: relative;
z-index: 1;
}
/* 脉冲动画 */
@keyframes pulse {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.05);
opacity: 0.8;
}
100% {
transform: scale(1);
opacity: 1;
}
}
.pulse-button {
animation: pulse 2s infinite;
}
/* 旋转动画 */
.rotate-button {
transition: transform 0.5s ease;
}
.rotate-button:hover {
transform: rotate(360deg);
}
/* 边框动画 */
.border-button {
background: transparent;
color: #ff3366;
border: 2px solid #ff3366;
transition: all 0.3s ease;
}
.border-button:hover {
background: #ff3366;
color: white;
}
/* 更多信息链接 */
.info-link {
display: block;
margin-top: 30px;
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.3s;
}
.info-link:hover {
color: #ff3366;
}
</style>
</head>
<body>
<div class="button-container">
<button class="animated-button">
<span>点击按钮</span>
</button>
<button class="animated-button pulse-button" style="margin-left: 20px;">
<span>脉冲效果</span>
</button>
<button class="animated-button rotate-button" style="margin-left: 20px; background: linear-gradient(45deg, #3498db, #2980b9); box-shadow: 0 5px 15px rgba(41, 128, 185, 0.4);">
<span>旋转效果</span>
</button>
<button class="animated-button border-button" style="margin-left: 20px; box-shadow: none;">
<span>边框动画</span>
</button>
</div>
</body>
</html>
600

被折叠的 条评论
为什么被折叠?



