This is a very simple pure CSS3 white cloud floating background effect. The floating white clouds special effect uses CSS animation to control different white clouds, moving at different speeds to create the effect of floating white clouds. HTML Structure The HTML result of this white cloud floating effect is very simple. A <div> is used to wrap a group of <div> elements as white clouds. <div id="clouds"> <div class="cloud x1"></div> <div class="cloud x2"></div> <div class="cloud x3"></div> <div class="cloud x4"></div> <div class="cloud x5"></div> </div> CSS Styles The white clouds are created using .cloud and its :before and :after pseudo-elements. .cloud { width: 200px; height: 60px; background: #fff; border-radius: 200px; -moz-border-radius: 200px; -webkit-border-radius: 200px; position: relative; } .cloud:before, .cloud:after { content: ''; position: absolute; background: #fff; width: 100px; height: 80px; position: absolute; top: -15px; left: 10px; border-radius: 100px; -moz-border-radius: 100px; -webkit-border-radius: 100px; -webkit-transform: rotate(30deg); transform: rotate(30deg); -moz-transform:rotate(30deg); } .cloud:after { width: 120px; height: 120px; top: -55px; left: auto; right: 15px; } Each cloud executes the moveclouds animation, but they animate at different speeds. Size and transparency also vary. .x1 { -webkit-animation: moveclouds 15s linear infinite; -moz-animation: moveclouds 15s linear infinite; -o-animation: moveclouds 15s linear infinite; } .x2 { left: 200px; -webkit-transform: scale(0.6); -moz-transform: scale(0.6); transform: scale(0.6); opacity: 0.6; /*opacity proportional to the size*/ /*Speed will also be proportional to the size and opacity*/ /*More the speed. Less the time in 's' = seconds*/ -webkit-animation: moveclouds 25s linear infinite; -moz-animation: moveclouds 25s linear infinite; -o-animation: moveclouds 25s linear infinite; } ...... @-webkit-keyframes moveclouds { 0% {margin-left: 1000px;} 100% {margin-left: -1000px;} } @-moz-keyframes moveclouds { 0% {margin-left: 1000px;} 100% {margin-left: -1000px;} } @-o-keyframes moveclouds { 0% {margin-left: 1000px;} 100% {margin-left: -1000px;} } The above is the details of how to use CSS3 to achieve a simple white cloud floating background effect. For more information about CSS3 special effects, please pay attention to other related articles on 123WORDPRESS.COM! |
<<: Causes and solutions for front-end exception 502 bad gateway
>>: 9 Practical CSS Properties Web Front-end Developers Must Know
Table of contents Summarize Summarize When the ar...
Table of contents Preface 1. Application componen...
I have never been able to figure out whether the ...
Pull the image docker pull mysql View the complet...
1. Check the synchronization status of A and B da...
Recently, many students have asked me about web p...
introduction: Nowadays, many dynamic verification...
1.1 Introduction to iptables firewall Netfilter/I...
Table of contents 1. Introduce cases 2. View the ...
Table partitioning is different from database par...
I have been studying and reviewing the developmen...
This article introduces the development environme...
The table structure is as follows: id varchar(32)...
The code looks like this: <!DOCTYPE html> &...
After installing the latest version 8.0.11 of mys...