div+css布局实现20个按钮鼠标悬停动画效果代码
代码语言:html
所属分类:悬停
代码描述:div+css布局实现20个按钮鼠标悬停动画效果代码
代码标签: div css 布局 20 按钮 鼠标 悬停 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
font-family: 'Segoe UI', sans-serif;
background: #222;
color: #fff;
margin: 0;
padding: 40px 20px;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}
h1 {
text-align: center;
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 0 0 10px #fff5;
}
.subtitle {
color: #ccc;
margin-bottom: 40px;
text-align: center;
font-size: 1.2rem;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 30px;
max-width: 1200px;
width: 100%;
}
.btn-container {
display: flex;
justify-content: center;
align-items: center;
}
button {
position: relative;
padding: 15px 30px;
font-size: 16px;
font-weight: bold;
border: none;
border-radius: 8px;
cursor: pointer;
transition: all 0.4s ease;
overflow: hidden;
color: white;
}
/* Common Effects */
.btn-effect-1 { border: 2px solid #0ff; background: transparent; color: #0ff; box-shadow: 0 0 5px #0ff; }
.btn-effect-1:hover { background: #0ff; color: #111; box-shadow: 0 0 20px #0ff, 0 0 40px #0ff; }
.btn-effect-2 { background: #ff3366; }
.btn-effect-2:hover { animation: explode 0.5s forwards; box-shadow: 0 0 30px #ff3366; }
.btn-effect-3 { background: #4a00e0; border-radius: 30px; }
.btn-effect-3:hover { background: #8e2de2; transform: translateY(-5px) scale(1.05); border-radius: 8px; }
.btn-effect-4 { background: #fd1d1d; position:relative}
.btn-effect-4::before, .btn-effect-4::after {
content: ''; position: absolute; top: 0; width: 50%; height: 100%; display:block;
background: #fd1d1d; z-index.........完整代码请登录后点击上方下载按钮下载查看
网友评论0