流畅卡片滚动切换效果

代码语言:html

所属分类:加载滚动

代码描述:流畅卡片滚动切换效果

代码标签: 切换 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
  margin: 0;
  font-size: 18px;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
  font-style: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  letter-spacing: 0.05em;
}

* {
  position: relative;
  box-sizing: border-box;
}

.box {
  width: 400px;
  height: 200px;
  color: white;
  margin: 0 auto;
  margin-bottom: 24px;
}

.box > div {
  display: flex;
  position: absolute;
  top: 0;
  width: 400px;
  height: 200px;
  background: linear-gradient(220deg, #3d45b1, #844efc);
  justify-content: space-between;
  flex-direction: column;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.2);
  transform-origin: top center;
  will-change: transform;
  overflow: hidden;
}

.content {
  display: flex;
  justify-content: space-between;
}

.label {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 6px;
}

.value-right {
  text-align: right;
}

svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
</style>

</head>
<body translate="no">


<script >
document.body.innerHTML += `
  <div style="height: 16px"></div>
`;

for (let i = 0; i < 10; i += 1) {
  document.body.innerHTML += `
    <div class="box"><div>
      <svg preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
        <defs>
          <linearGradient id="linear" x1="0%" y1="0%" x2="100%" y2="0%">
            <stop offset="0%" stop-color="#f079ba"/>
            <stop offset="100%" stop-color.........完整代码请登录后点击上方下载按钮下载查看

网友评论0