Make a fade animation effect with CSS3

Source: Internet
Author: User

CSS3 new Animated attribute "@-webkit-keyframes", literally can see its meaning-keyframe, which is consistent with the meaning in Flash.

Animating with CSS3 the same principle as flash, we need to define the state effect at the keyframe, which is driven by the CSS3 to produce the animation effect.

Here's how you can use CSS3 to create a fade-out animation effect. The specific example can refer to the fade-in effect when you first enter this site.

1. Define the animation, named Fadein
@-webkit-keyframes fadeIn {0% {opacity: 0; /*初始状态 透明度为0*/}50% {opacity: 0; /*中间状态 透明度为0*/}100% {opacity: 1; /*结尾状态 透明度为1*/}}
2. Add the following animation code to the ID or class
#box{-webkit-animation-name: fadeIn; /*动画名称*/-webkit-animation-duration: 3s; /*动画持续时间*/-webkit-animation-iteration-count: 1; /*动画次数*/-webkit-animation-delay: 0s; /*延迟时间*/}

The above code allows for a fade-out animation effect, and the specific meaning of the code is noted in the note.

Instance address: CSS3 Fadein fade in animation animation interesting phenomenon

Make a fade animation effect with CSS3

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.