div+css实现按钮鼠标悬浮阴影效果代码

代码语言:html

所属分类:悬停

代码描述:div+css实现按钮鼠标悬浮阴影效果代码

代码标签: div css 按钮 鼠标 悬浮 阴影

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


  
  
<style>
body {
  background: floralwhite;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, 5vmin);
}

.button {
  background: seagreen;
  display: inline-flex;
  padding: 1rem 2rem;
  color: #fff;
  text-decoration: none;
  transition: all 150ms ease-out;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid seagreen;
  align-items: center;
  gap: 0.75rem;
}

.button svg {
  color: darkseagreen;
  transition: color 150ms ease-out;
}

.button:hover,
.button:focus {
  background: forestgreen;
  border-color: forestgreen;
  box-shadow: 5px 5px 0 rgba(34, 139, 34, 0.3);
}

.button:hover svg,
.button:focus svg {
  color: #fff;
}

.button--danger {
  background: tomato;
  border-color: tomato;
}

.button--danger svg {
  color: firebrick;
}

.button--danger:hover,
.button--danger:focus {
  background: firebrick;
  border-color: firebrick;
  box-shadow: 5px 5px 0 rgba(178, 34, 34, 0.3);
}

.button--secondary {
  background: transparent;
  color: seagreen;
}

.button--secondary svg {
  color: seagreen;
}

.button--secondary:hover,
.button--secondary:focus {
  background: rgba(34, 139, 34, 0.1);
  border-color: forestgreen;
  color: forestgreen;
}

.button--secondary:hover svg,
.button--secondary:focus svg {
  color: forestgreen;
}

.button--secondary.button--danger {
  color: tomato;
}

.button--secondary.button--danger svg {
  color: tomato;
}

.button--secondary.button--danger:hover,
.button--secondary.button--danger:focus {
  background: rgba(178, 34, 34, 0.1);
  border-color: firebrick;
  color: firebrick;
}

.button--secondary.button--danger:hover svg,
.button--secondary.button--danger:focus svg {.........完整代码请登录后点击上方下载按钮下载查看

网友评论0