877
CSS background animation with line falling effects
Creating a background animation with CSS and HTML is a great way to add visual interest to your website. You can use CSS animations to achieve various effects. Here’s a simple example of a background animation using CSS and HTML:
You can customize the colors, animation duration, and other properties to create the background animation that suits your website’s design. This is just a basic example, and you can create more complex and creative background animations using CSS and HTML to enhance the visual appeal of your website.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> background animation with HTML and CSS </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="lines">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</div>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box !important; }
html, body {
height: 100%; }
body {
display: table;
width: 100%;
height: 100%;
background-color: #262626;
color: #000;
line-height: 1.6;
position: relative;
font-family: sans-serif;
overflow: hidden; }
.lines {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
margin: auto;
width: 90vw; }
.line {
position: absolute;
width: 2px;
height: 100%;
top: 0;
left: 50%;
background: rgba(255, 255, 255, 0.1);
overflow: hidden; }
.line::after {
content: '';
display: block;
position: absolute;
height: 15vh;
width: 100%;
top: -50%;
left: 0;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #ffffff 75%, #ffffff 100%);
animation: drop 7s 0s infinite;
animation-fill-mode: forwards;
animation-timing-function: cubic-bezier(0.4, 0.26, 0, 0.97); }
.line:nth-child(1) {
margin-left: -25%; }
.line:nth-child(1)::after {
animation-delay: 2s; }
.line:nth-child(3) {
margin-left: 25%; }
.line:nth-child(3)::after {
animation-delay: 2.5s; }
@keyframes drop {
0% {
top: -50%; }
100% {
top: 110%; } }
For More Tutorials Please Click Here