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
1. Linux installation (root user operation) 1. In...
Table of contents 1. ChildNodes attribute travers...
Table of contents Install mockjs in your project ...
In the process of designing a web page, designers...
In the previous article, I introduced the detaile...
The MySQL built on Tencent Cloud is always very s...
First look at the effect diagram: The complete co...
Create a container [root@server1 ~]# docker run -...
Table of contents 1. Introduction to ReactJS 2. U...
Table of contents Preface analyze Data Total Repe...
1: Differences in speed and loading methods The di...
Table of contents 1. Use object to create an obje...
It's embarrassing to say that I had to search ...
For a website, usability refers to whether users c...
1. Common connections for mysql INNER JOIN (inner...