css实现水中月倒影代码

代码语言:html

所属分类:布局界面

代码描述:css实现水中月倒影代码

代码标签: css 水中 倒影 代码

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

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

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

  
  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(
    180deg,
    #0c1445 0%,
    #1a1f4a 30%,
    #2d3561 60%,
    #1e2347 100%
  );
  min-height: 100vh;
  font-family: "Arial", sans-serif;
  overflow: hidden;
  position: relative;
}

/* Stars in the sky */
.stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: transparent;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite alternate;
}

.star:nth-child(1) {
  width: 2px;
  height: 2px;
  top: 10%;
  left: 15%;
  animation-delay: 0s;
}
.star:nth-child(2) {
  width: 1px;
  height: 1px;
  top: 15%;
  left: 30%;
  animation-delay: 1s;
}
.star:nth-child(3) {
  width: 3px;
  height: 3px;
  top: 8%;
  left: 70%;
  animation-delay: 2s;
}
.star:nth-child(4) {
  width: 1px;
  height: 1px;
  top: 20%;
  left: 80%;
  animation-delay: 0.5s;
}
.star:nth-child(5) {
  width: 2px;
  height: 2px;
  top: 12%;
  left: 90%;
  animation-delay: 1.5s;
}
.star:nth-child(6) {
  width: 1px;
  height: 1px;
  top: 25%;
  left: 20%;
  animation-delay: 2.5s;
}
.star:nth-child(7) {
  width: 2px;
  height: 2px;
  top: 18%;
  left: 60%;
  animation-delay: 3s;
}
.star:nth-child(8) {
  width: 1px;
  height: 1px;
  top: 22%;
  left: 45%;
  animation-delay: 0.8s;
}

@keyframes twinkle {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }
  100% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Main container */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}

/* Moon container */
.moon-container {
  position: relative;
  z-index: 10;
  margin-bottom: 50px;
}

/* Main Moon */
.moon {
  width: 200px;
  height: 200px;
  border-radius: 50%;
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0