div+css实现圣诞树与礼物代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现圣诞树与礼物代码

代码标签: div css 圣诞树 礼物 代码

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


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

<head>

  <meta charset="UTF-8">
  

<meta name="viewport" content="width=device-width, initial-scale=1">
  
  
  
<style>
.christmas-tree {
  font-size: 1.35vmin;
  position: absolute;
  bottom: 0%;
  left: 50%;
  transform: translate(-50%, 0%);
  width: 60em;
  height: 60em;
}

.christmas-tree *,
.christmas-tree *::before,
.christmas-tree *::after {
  position: absolute;
  box-sizing: border-box;
}

.leaves {
  --pos: 0;
  --mask: radial-gradient(farthest-side at 0 0, #000 94%, #0000 0) 0 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 100% 0, #000 94%, #0000 0) 100% 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 97%, #0000 0) -10% 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 97%, #0000 0) 110% 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 20% 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 80% 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 100%, #0000 0) 50% 0 / 50% 100% no-repeat;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0);
  width: 20em;
  height: 20em;
  background: red;
  border-radius: 100% / 20%;
  -webkit-mask: 
    var(--mask)
    ;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    radial-gradient(at 50% var(--pos), #050c 40%, #0000),
    radial-gradient(at 50% 0, #0000, #0f08),
    repeating-conic-gradient(at 50% var(--pos), #0000 0 2%, #080 0 2.5%),
    repeating-conic-gradient(at 50% var(--pos), #0000 0 1.5%, #0a0 0 2%),
    repeating-conic-gradient(at 50% var(--pos), #0000 0 1.25%, #090 0 1.75%),
    repeating-conic-gradient(at 50% var(--pos), #0000 0 0.5%, #060 0 1%),
    repeating-conic-gradient(at 50% var(--pos), #0000 0 1%, #050 0 1.25%),
    repeating-conic-gradient(at 50% var(--pos), #070 0 2%, #080 0 2.5%),
    red;
}

.leaves:nth-child(2) {
  --pos: 5%;
  width: 40em;
  height: 40em;
  top: 9em;
  --mask: radial-gradient(farthest-side at 0 0, #000 94%, #0000 0) 0 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 100% 0, #000 94%, #0000 0) 100% 0 / 50% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 97%, #0000 0) 5% 0 / 20% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 97%, #0000 0) 15% 0 / 24% 100% no-repeat,
    radial-gradient(farthest-side at 45% 0, #000 99%, #0000 0) 25% 0 / 20% 99% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 35% 0 / 22% 99% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 45% 0 / 20% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 55% 0 / 19% 99.5% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 100%, #0000 0) 65% 0 / 22% 100% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 75% 0 / 20% 99.5% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 99%, #0000 0) 85% 0 / 23% 99.5% no-repeat,
    radial-gradient(farthest-side at 50% 0, #000 97%, #0000 0) 95% 0 / 21% 99% no-repeat;
}

.leaves:nth-child(3) {
  --pos: -5%;
  width: 30em;
  height: 30em;
  top: 4em;
  transform: translat.........完整代码请登录后点击上方下载按钮下载查看

网友评论0