div+css实现卡片边框光线走动动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现卡片边框光线走动动画效果代码

代码标签: div css 卡片 边框 光线 走动 动画

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

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

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


  
  
<style>
@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0turn;
  inherits: false;
}

.card {
  animation: 2s gradient-angle infinite linear;
  border: 2px solid transparent;
  background-image: linear-gradient(#584827, #2d230f),
    conic-gradient(
      from var(--gradient-angle),
      #584827 0%,
      #c7a03c 37%,
      #f9de90 30%,
      #c7a03c 33%,
      #584827 40%,
      #584827 50%,
      #c7a03c 77%,
      #f9de90 80%,
      #c7a03c 83%,
      #584827 90%
    );
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
}

@keyframes gradient-angle {
  to {
    --gradient-angle: 1turn;
  }
}

html,
body {
  background: #141819;
}

body {
  font-family: Meiryo, sans-serif;
  line-height: 1.6;
  display: grid;
  align-content: center;
  min-height: 100svh;
  padding: 24px;
  color: #d5cec0;
  gap: 24px;

  @media (width < 970px) {
    align-content: start;
  }
}

.container {
  display: grid;
  justify-content: center;
  margin-inline: auto;
  grid-auto-flow: column;
  gap: 16px 40px;
  @media (width < 970px) {
    grid-auto-flow: row;
  }
}

.card {
  display: grid;
  max-width: 240px;
  padding: 20px;
  text-decoration: none;
  color: currentColor;
  border-radius: 20px;
  place-content: center;
  place-items: center;
  aspect-ratio: 1/1;
  row-gap: 16px;
}

.card h2 {
  font-family: &.........完整代码请登录后点击上方下载按钮下载查看

网友评论0