css 배경 효과
강의
스크린샷
필요한 코드
- 배경화면
background: linear-gradient(to left, #8942a8, #ba382f);
- 그라데이션 효과를 준다
- 공통 박스 만들기
display: block;
list-style: none;
width: 25px;
height: 25px;
background: rgba(255, 255, 255, 0.2);
animation: animate 20s linear infinite;
- 블록을 디자인하고, 애니메이션 효과를 준다
- 각 박스마다 스타일 다르게 주기
width: 30px;
height: 30px;
혹은
width: 100px;
height: 100px;
- 각 li에 애니메이션 딜레이 효과와 속도를 준다
animation-delay: 0s;
혹은
animation-delay: 1.5s;
animation-duration: 10s;
혹은
animation-delay: 5.5s;
혹은
animation-delay: 0s;
animation-duration: 15s;
혹은
animation-delay: 0s;
혹은
animation-delay: 3.5s;
- 각 li에 left:퍼센트 로 위치를 조정한다
left: 12%
혹은
left: 75%
혹은
left: 61%;
- 박스 굴리는 에니메이션 추가
@keyframes animate {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(-800px) rotate(360deg);
opacity: 0;
}
}
- html코드
<div class="animation-area">
<ul class="box-area">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
전체 코드
<!DOCTYPE html>
<!--Code by Divinector - divinectorweb.com-->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>animated background with pure css and html</title>
<link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
}
body {
font-family: 'Baloo 2', cursive;
}
.banner-text {
width: 100%;
position: absolute;
z-index: 1;
}
.banner-text ul {
height: 50px;
float: right;
}
.banner-text ul li {
display: inline-block;
padding: 40px 15px;
text-transform: uppercase;
color: #fff;
font-size: 20px;
}
.banner-text ul li:hover {
cursor: pointer;
}
.banner-text h2 {
text-align: center;
color: #fff;
font-size: 50px;
margin-top: 20%;
}
.animation-area {
background: linear-gradient(to left, #8942a8, #ba382f);
width: 100%;
height: 100vh;
}
.box-area {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.box-area li {
position: absolute;
display: block;
list-style: none;
width: 25px;
height: 25px;
background: rgba(255, 255, 255, 0.2);
animation: animate 20s linear infinite;
bottom: -150px;
}
.box-area li:nth-child(1) {
left: 86%;
width: 80px;
height: 80px;
animation-delay: 0s;
}
.box-area li:nth-child(2) {
left: 12%;
width: 30px;
height: 30px;
animation-delay: 1.5s;
animation-duration: 10s;
}
.box-area li:nth-child(3) {
left: 70%;
width: 100px;
height: 100px;
animation-delay: 5.5s;
}
.box-area li:nth-child(4) {
left: 42%;
width: 150px;
height: 150px;
animation-delay: 0s;
animation-duration: 15s;
}
.box-area li:nth-child(5) {
left: 65%;
width: 40px;
height: 40px;
animation-delay: 0s;
}
.box-area li:nth-child(6) {
left: 15%;
width: 110px;
height: 110px;
animation-delay: 3.5s;
}
@keyframes animate {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(-800px) rotate(360deg);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="banner-text">
<ul>
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Services</li>
<li>Contact</li>
</ul>
<h2>Welcome to our Website</h2>
</div>
<div class="animation-area">
<ul class="box-area">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
Author And Source
이 문제에 관하여(css 배경 효과), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://velog.io/@nahyunbak/css-배경-효과
저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
background: linear-gradient(to left, #8942a8, #ba382f);
display: block;
list-style: none;
width: 25px;
height: 25px;
background: rgba(255, 255, 255, 0.2);
animation: animate 20s linear infinite;
width: 30px;
height: 30px;
혹은
width: 100px;
height: 100px;
animation-delay: 0s;
혹은
animation-delay: 1.5s;
animation-duration: 10s;
혹은
animation-delay: 5.5s;
혹은
animation-delay: 0s;
animation-duration: 15s;
혹은
animation-delay: 0s;
혹은
animation-delay: 3.5s;
left: 12%
혹은
left: 75%
혹은
left: 61%;
@keyframes animate {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(-800px) rotate(360deg);
opacity: 0;
}
}
<div class="animation-area">
<ul class="box-area">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<!DOCTYPE html>
<!--Code by Divinector - divinectorweb.com-->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>animated background with pure css and html</title>
<link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
}
body {
font-family: 'Baloo 2', cursive;
}
.banner-text {
width: 100%;
position: absolute;
z-index: 1;
}
.banner-text ul {
height: 50px;
float: right;
}
.banner-text ul li {
display: inline-block;
padding: 40px 15px;
text-transform: uppercase;
color: #fff;
font-size: 20px;
}
.banner-text ul li:hover {
cursor: pointer;
}
.banner-text h2 {
text-align: center;
color: #fff;
font-size: 50px;
margin-top: 20%;
}
.animation-area {
background: linear-gradient(to left, #8942a8, #ba382f);
width: 100%;
height: 100vh;
}
.box-area {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.box-area li {
position: absolute;
display: block;
list-style: none;
width: 25px;
height: 25px;
background: rgba(255, 255, 255, 0.2);
animation: animate 20s linear infinite;
bottom: -150px;
}
.box-area li:nth-child(1) {
left: 86%;
width: 80px;
height: 80px;
animation-delay: 0s;
}
.box-area li:nth-child(2) {
left: 12%;
width: 30px;
height: 30px;
animation-delay: 1.5s;
animation-duration: 10s;
}
.box-area li:nth-child(3) {
left: 70%;
width: 100px;
height: 100px;
animation-delay: 5.5s;
}
.box-area li:nth-child(4) {
left: 42%;
width: 150px;
height: 150px;
animation-delay: 0s;
animation-duration: 15s;
}
.box-area li:nth-child(5) {
left: 65%;
width: 40px;
height: 40px;
animation-delay: 0s;
}
.box-area li:nth-child(6) {
left: 15%;
width: 110px;
height: 110px;
animation-delay: 3.5s;
}
@keyframes animate {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(-800px) rotate(360deg);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="banner-text">
<ul>
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Services</li>
<li>Contact</li>
</ul>
<h2>Welcome to our Website</h2>
</div>
<div class="animation-area">
<ul class="box-area">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
Author And Source
이 문제에 관하여(css 배경 효과), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@nahyunbak/css-배경-효과저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)