Queries about CSS3 Animations

I am attempting to make three elements appear sequentially on the page, but I'm encountering an issue. When I implement my code, all three elements show up at once, with the first element seemingly skipping its animation entirely. Then, the second element disappears before restarting its animation, followed by the third element doing the same.

Below is the code I have written. Can you help me identify what might be missing or causing this unexpected behavior?

@-webkit-keyframes reset {
    0% {opacity: 0;}
    100% {opacity: 0;}
}

@-webkit-keyframes fade-in {
0% { opacity: 0; -webkit-transform: scale(.1);}
85% {opacity: 1; -webkit-transform: scale(1.05);}
100% {-webkit-transform: scale(1);}
}


.fade-in {
    -webkit-animation-name: reset, fade-in;
    -webkit-animation-duration: .5s;
    -webkit-animation-timing-function: ease-in;
    -webkit-animation-iteration-count: 1;
}

.fade-in.one {-webkit-animation-delay: 0, .5;}
.fade-in.two {-webkit-animation-delay: 0, 1.5s;}
.fade-in.three {-webkit-animation-delay: 0, 2.5s;}

Any assistance is greatly appreciated. Thank you!

Answer №1

Your code is missing the time unit, which is causing the main problem...

.fade-in.one {-webkit-animation-delay: 0, .5s;}

After testing your code, I found a way to simplify it. You can use the -webkit-animation-fill-mode property to keep your animation in its final state without having two separate animations. Here's my revised version:

@-webkit-keyframes fade-in {
    0% { opacity: 0; -webkit-transform: scale(.1);}
    85% {opacity: 1; -webkit-transform: scale(1.05);}
    100% {-webkit-transform: scale(1); opacity: 1;}
}

.fade-in {
  -webkit-animation: fade-in .5s ease-in;
  -webkit-animation-fill-mode: forwards;
  -webkit-animation-iteration-count: 1;
  opacity: 0;
}

.fade-in.one {-webkit-animation-delay: .5s;}
.fade-in.two {-webkit-animation-delay: 1.5s;}
.fade-in.three {-webkit-animation-delay: 2.5s;}

You can view the updated code here:

http://jsfiddle.net/vqfj7/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Positioning a CSS dropdown menu within a wrapper that has a hidden overflow

Although the title may be vague, it's challenging to encapsulate exactly what I'm looking for in just a single sentence. The issue at hand is this: I have a template featuring multiple dropdown menus that are activated by jQuery. These dropdown ...

What can I do to prevent my HTML/CSS/jQuery menu text from shifting when the submenu is opened?

After encountering numerous inquiries regarding the creation of disappearing and reappearing menus, I successfully devised a solution that functions seamlessly on desktop and tablet devices. My approach involved utilizing the jQuery .toggleClass function w ...

Guide on utilizing popup box input to amend CSS (background color)

I'm looking for some guidance on JavaScript and CSS. Is there a way to create a popup box where users can input a color (any main primary color recognized by CSS) and then have the background color of the page change accordingly in an external styles ...

What is the best method for efficiently loading SVG icons on an HTML page without redundancy? / Is utilizing <use href> recommended?

My struggle with implementing icons in Angular While working on a new Angular project, I've encountered challenges with my current SVG-icon implementation method from a previous project (@ngneat/svg-icon). The process involves organizing SVG files in ...

steps for marking comments as read or unread by multiple users

I'm working on a development blog for my project and I'd like to add a feature where users can mark comments as unread until they view them. For example, if an admin posts a comment, all users in that project should see it as unread. Can anyone ...

How come ng-class doesn't apply to a specific class name?

I recently wrote the following code: <style> .dotted { border:dotted; } </style> .... <p ng-style="mystyle" ng-class="dotted">{{ answer }}</p> My intention was to have the paragraph element enclosed within a ...

Looking for assistance on how to automatically close the sidebar or pull navigation menu after clicking on a menu item

My website is designed to be responsive and includes a navigation slider that is hidden off-screen by default. The slider features a vertical push/pull bar that remains visible for users to access the menu. The entire navigation slider is fixed on the page ...

Is there a way to display MySQL data row by row within distinct divs using a loop?

I need to display more than 50 rows from a MySQL database in a grid view with different colors and sizes. Below is the code I am using to fetch the rows, but I'm struggling with assigning unique anchor tags to each row. <?php $products ...

Ways to incorporate a border line between a pair of icons within a bootstrap card

Incorporating a border line within the card-header is my current goal. My approach involves positioning two icons - one on the left side and the other on the right. Illustrative example below: https://i.sstatic.net/BgxVu.png Utilizing HMTL and CSS to ac ...

Can the <p> tags be aligned to ensure they are evenly spaced?

Is there a way to transform this https://i.sstatic.net/944F8.png Into this: https://i.sstatic.net/k4Ch8.png I want the second column to be uniform across all categories. Here is how my current code appears: <div class="prod-card-f ...

What is the best way to navigate through a series of images using left and right arrows in a React

I need help implementing a feature where I can slide horizontally through a collection grid of 10 movie items per row, similar to Netflix grids. Is there an easy way to achieve this with arrows on the right and left ends? <div className="collection-p ...

Embracing the cutting-edge technology of the Wordpress revolution slider for an HTML

Is it possible to integrate the WordPress Revolution Slider into a website without using WordPress (just HTML and CSS)? I've attempted to search for JavaScript solutions, but there are too many scripts available. ...

Struggling to align Social Media Share Buttons in inline format for a website

I'm having trouble aligning these social media share buttons with my inline list. I tried using vertical-align: top; on the <li> element, but it didn't work in Chrome. You can view the page here: Here is the full HTML/CSS code: <!DOCT ...

Create curved edges for the divs inside other divs

I am currently working on creating rounded corners for my responsive table using div elements. However, I am encountering an issue where the top part of the div is not being rounded as expected. Here is a preview of my current progress: https://i.sstatic. ...

Footer panel in Bootstrap not aligning to the bottom of the page

I'm experiencing an issue with my footer getting stuck in the middle of the page. Strangely, this problem only occurs on one specific page, and not on any other pages. I've tried various methods to fix it, but none of them have been successful. ...

Troubleshooting Vertical Centering Issue with Flex in Ionic and ReactJS Not Yielding Results

Feel free to experiment with this Ionic / ReactJS project on Stackblitz: https://stackblitz.com/edit/ionic-react-routing-ctdywr?file=src%2Fpages%2FGreetings.tsx Here is the code snippet: import React from 'react'; import { IonButton, IonContent ...

CSS responsive grid - adding a horizontal separator between rows

I currently have a responsive layout featuring a grid of content blocks. For desktop view, each row consists of 4 blocks. When viewed on a tablet, each row displays 3 blocks. On mobile devices, each row showcases 2 blocks only. I am looking to add a ho ...

Is there a way to switch the cursor to a pointer when hovering over a bar on a ChartJS bar graph?

Here's the chart I created: createChart = function (name, contributions, idArray) { globalIdArray = idArray; var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: "bar", data: { lab ...

The h3 element is not responding to the adjacent sibling selector

Below is my HTML DOM structure. I am trying to remove the margin and padding for all h3 elements that are immediate siblings of a div with the id "successor". I attempted to achieve this using the adjacent sibling selector "+", but unfortunately, I'm ...

Responsive navigation menu featuring dynamic dropdown menus using HTML and CSS

Looking to design a responsive HTML and CSS navigation menu with multiple dropdown menus? You're in the right place. I've scoured countless YouTube videos, but haven't quite found the perfect template for a two-part navigation menu that tic ...