div+css实现立体质感有序列表效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现立体质感有序列表效果代码

代码标签: div css 立体 质感 有序 列表

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

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

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

  
  
  
<style>
body {
  background-color: #c4c5c7;
  padding: 2rem;
}
ol, ol > li {
  margin: 0; 
  padding: 0; 
  box-sizing: border-box;
}
ol {
  width: min(400px, 100% - 2rem);
  margin-inline: auto;
  list-style: none;
  display: grid;
  font-family: system-ui, sans-serif;
  color: white;
  counter-reset: liCount;
}
ol > li {
  --number-size: 3rem;
  --padding-inline: 2.5rem;
  --padding-block: 0.5rem;
  margin-block: var(--padding-block);
  padding: var(--padding-block) var(--padding-inline);
  background-color: var(--accent-color);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-auto-flow: dense;
  align-items: center;
  gap: calc(1rem + var(--padding-block));
  border-radius: 100vmax;
  box-shadow: 
    inset 0.15rem 0.15rem hsl(0 0% 0% / .125),
    inset 0.5rem 0.5rem 1rem hsl(0 0% 0% / .5),
    inset -0.15rem -0.15rem hsl(0 0% 100% / .75);
  position: relative;
  isolation: isolate;
  counter-increment: liCount;
}
ol > li::before {
  content: counter(liCount);
  font-size: calc(var(--number-size) / 2);
  color: var(--accent-color);
  width: var(--number-size);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 100vmax;
  background-color: #e6e7e9;
  box-shadow: 
    inset 0.05rem 0.05rem hsl(0 0% 100% / .75),
    0.25rem 0.25rem 0.5rem hsl(0 0% 0% / .5),
    inset -0.05rem -0.05rem hsl(0 0% 0% / .125);
}
ol > li::a.........完整代码请登录后点击上方下载按钮下载查看

网友评论0