Dynamic background
Use the alternate fade-in and fade-out of multiple layers of background to achieve the effect of a constantly changing background. See the picture first. Rendering:
DEMO address
1. Use CSS’s radial-gradient to create a mirror gradient background. 80% and 20% of them are the x, y positions of the gradient center.
The specific usage of radial-gradient can be found here
.dynbg__bg{ position: absolute; top: 0px; left: 0px; width:100%; height:100%; background:-moz-radial-gradient(80% 20%,farthest-side, #edbf47, #D58123); background:-webkit-radial-gradient(80% 20%,farthest-side, #edbf47, #D58123);}
Online code
2. Repeat the first step to create 4 DIVs with different gradient backgrounds. The positions of the gradient center points are 80% 20% 80% 80% 20% 80 % 20%
.dynbg__bg{ position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-size: 100% 100%;}.dynbg__bg1{ background:-moz-radial-gradient(80% 20%,farthest-side, #edbf47, #D58123); background:-webkit-radial-gradient(80% 20%,farthest-side, #edbf47, #D58123); z-index: 4;}.dynbg__bg2{ background:-moz-radial-gradient(80% 80%,farthest-side, #edbf47, #D58123); background:-webkit-radial-gradient(80% 80%,farthest-side, #edbf47, #D58123); z-index: 3;}.dynbg__bg3{ background:-moz-radial-gradient(20% 80%,farthest-side, #edbf47, #D58123); background:-webkit-radial-gradient(20% 80%,farthest-side, #edbf47, #D58123); z-index: 2;}.dynbg__bg4{ background:-moz-radial-gradient(20% 20%,farthest-side, #edbf47, #D58123); background:-webkit-radial-gradient(20% 20%,farthest-side, #edbf47, #D58123); z-index: 1;}
The effect of the four divs
3. Place the four divs on top of each other in order, and change the transparency of the divs from 1 to 0 and then to 1 in order. The transparency of the last div does not need to be changed, so one needs to change 3 divs. Each div changes in two states, so there are 6 states in total. We divide 100% by 6 and divide it into 0%, 16.6667%, 33.3333%, 50%, 66.6667%, 83.3333%, and 100%. The status of each div at different stages is as follows.
@-webkit-keyframes dynbg__ani1{ 0%{ opacity: 1; } 16.6667%{ opacity: 0; } 33.3333%{ opacity: 0; } 50%{ opacity: 0; } 66.6667%{ opacity: 0; } 83.3333%{ opacity: 0; } 100%{ opacity: 1; }}@-webkit-keyframes dynbg__ani2{ 0%{ opacity: 1; } 16.6667%{ opacity: 1; } 33.3333%{ opacity: 0; } 50%{ opacity: 0; } 66.6667%{ opacity: 0; } 83.3333%{ opacity: 1; } 100%{ opacity: 1; }}@-webkit-keyframes dynbg__ani3{ 0%{ opacity: 1; } 16.6667%{ opacity: 1; } 33.3333%{ opacity: 1; } 50%{ opacity: 0; } 66.6667%{ opacity: 1; } 83.3333%{ opacity: 1; } 100%{ opacity: 1; }}
Then add the animation attribute to the div class
.dynbg__bg{ ... -webkit-transition:all 1s linear; -moz-transition:all 1s linear; ...}.dynbg__bg1{ ... -webkit-animation:dynbg__ani1 infinite 8s; -moz-animation:dynbg__ani1 infinite 8s;}.dynbg__bg2{ ... -webkit-animation:dynbg__ani2 infinite 8s; -moz-animation:dynbg__ani2 infinite 8s;}.dynbg__bg3{ ... -webkit-animation:dynbg__ani3 infinite 8s; -moz-animation:dynbg__ani3 infinite 8s;}.dynbg__bg4{ ...}
In this way, the three pictures will be displayed in sequence. It becomes transparent and then changes back to display.
For how to use transition, please refer here
For how to use animation, please refer here
4. Finally, add a layer of tiled translucency on top points to add texture.
.dynbg__bg0{ background-repeat: repeat; background: -webkit-radial-gradient(rgba(255,255,255,0.4) 5%, transparent 10%); background: -moz-radial-gradient(rgba(255,255,255,0.4) 5%, transparent 10%); background-size: 16px 16px; z-index: 5;}
Online code
If you have any questions or suggestions, please tweet @UED天记. I will reply promptly
github address
Related reading
1. Wavy dynamic background

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools