div+css布局实现不锈钢checkbox开关切换效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css布局实现不锈钢checkbox开关切换效果代码

代码标签: div css 布局 不锈钢 checkbox 开关 切换

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

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

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

  
  
<style>
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  gap: 2em;
  margin: 0;
  min-height: 100vh;
  background: 
    repeating-linear-gradient(transparent 0 13%, #ffffff08 0 calc(13% + 1px), transparent 0) 30% 0% / 40% 100%,
    repeating-linear-gradient(transparent 0 7%, #ffffff0a 0 calc(7% + 1px), transparent 0) 70% 0% / 33% 100%,
    repeating-linear-gradient(transparent 0 11%, #ffffff08 0 calc(11% + 1px), transparent 0) -10% 0% / 35% 100%,
    repeating-linear-gradient(transparent 0 17%, #ffffff11 0 calc(17% + 1px), transparent 0) 110% 0% / 27% 100%,
    repeating-linear-gradient(transparent 0 13%, #00000008 0 calc(13% + 1px), transparent 0) 60% -10% / 33% 100%,
    repeating-linear-gradient(transparent 0 8%, #00000008 0 calc(8% + 1px), transparent 0) 21% 2% / 27% 100%,
    repeating-linear-gradient(transparent 0 8%, #00000002 0 calc(8% + 1px), transparent 0) 31% 7% / 19% 100%,
    
    repeating-linear-gradient(transparent 0 13%, #00000004 0 calc(13% + 1px), transparent 0) 71% 15% / 19% 100%,
    linear-gradient(-45deg, #767a80, #b8b8bb);
  font-size: 2rem;
}

.metal {
  appearance: none;
  position: relative;
  width: 2.5em;
  aspect-ratio: 4;
  background: 
    repeating-linear-gradient(#0000 0 5%, #0001 0 10%),
    linear-gradient(#0003,#0002,#0003),
    #999;
  box-shadow: 
    0 0 0.05em #fff8,
    inset 0 0.05em 0.125em 0.05em #0005;
  border-radius: 100vmax; 
  font-size: 1em;
  border: 1px solid #0000;
  
  &::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 25%;
    width: 60%;
    aspect-ratio: 1;
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0