CSS3 for loading effects

Source: Internet
Author: User

The expected implementation effect is as follows

First, the basic HTML layout is as follows

  <div id= "wrap" >
    <div class= "line1" ></div>
    <div class= "line2" ></div>
    <div class= "Line3" ></div>
    <div class= "line4" ></div>
    <div class= "Line5" >< /div>
  </div>

For the CSS code below
First set the basic style

#wrap {
  width:400px;
  height:400px;
  position:relative;
  margin:150px auto;
}
#wrap Div {
    width:8px;
    height:50px;
    Background-color:pink;
    Float:left;
    margin-left:1px;
    border-radius:10%;
}

Once the CSS style definition is complete, there will be five neatly lined strips on the page.

Then we'll add the animation effect
Add the following code to the #wrap div

-webkit-animation:fadeout 1s infinite ease-in-out;

The code for fadeout is as follows

@-webkit-keyframes FadeOut {
  0,
  40%,
  100% {
    -webkit-transform:scaley (0.4);
  }
  20% {
    -webkit-transform:scaley (1);
  }
}

This time, the small strips on the page are moving neatly.

So now it's time to use Animation-delay to set the animation's trigger, to achieve the original effect

#wrap. line1 {
  -webkit-animation-delay: -0.9s;
}
#wrap. line2 {
  -webkit-animation-delay: -0.8s;
}
#wrap. line3 {
  -webkit-animation-delay: -0.7s;
}
#wrap. line4 {
  -webkit-animation-delay: -0.8s;
}
#wrap. line5 {
  -webkit-animation-delay: -0.9s;
}

The above results are achieved in the first diagram.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.