Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Frankie

Thread: what does these percentages mean

  1. #1
    New Coder
    Join Date
    Aug 2014
    Posts
    10
    Thanks
    10
    Thanked 0 Times in 0 Posts

    what does these percentages mean

    the following code is from w3school,,,,what is meant by these lines in the code
    0% {top: 0px;}
    25% {top: 200px;}
    75% {top: 50px}
    100% {top: 100px;}
    and
    -webkit-animation: mymove 5s infinite;
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <style> 
    div {
        width: 100px;
        height: 100px;
        background: red;
        position :relative;
        -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */ 
        animation: mymove 5s infinite;
    }
    
    /* Chrome, Safari, Opera */ 
    @-webkit-keyframes mymove {
        0%   {top: 0px;}
        25%  {top: 200px;}
        75%  {top: 50px}
        100% {top: 100px;}
    }
    
    /* Standard syntax */
    @keyframes mymove {
        0%   {top: 0px;}
        25%  {top: 200px;}
        75%  {top: 50px}
        100% {top: 100px;}
    }
    </style>
    </head>
    <body>
    
    <p><strong>Note:</strong> The @keyframes rule is not supported in Internet Explorer 9 and earlier versions.</p>
    
    <div></div>
    
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    343
    Thanks
    3
    Thanked 37 Times in 37 Posts
    mymove = (self given) name of the animation;
    5s = duration of one cycle of the animation (5 seconds);
    infinite = animation goes on forever;

    0% {top: 0px;} = at the start of the animation cycle, the object is vertically positioned at 0px of its parent element;
    25% {top: 200px;} = at 25% of 5s (1,25s), the object is vertically positioned at 200px of its parent element;
    etc.
    hareem likes this.
    Frank

    How to: Target IE in, Position in, Center in, Create a Fixed ('Sticky') Footer with, and Create a Drop-Down/Fly-Out Menu with CSS: Website Laten Maken Amsterdam.

  • Users who have thanked Frankie for this post:

    hareem (09-06-2014)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •