Issue with CSS3 animation in Chrome: @keyframes not incorporating transition

Below is the code I'm using for my animation:

<div id="slider" style="width: 230px; height: 150px; padding:5px">
    <div id="mask">
        <ul style="list-style:none;">
            <li class='firstAnimation'>
                <h2>First Word</h2>
            </li>
            <li class="secondAnimation" style="color: red;">
                <h2><strong>Second Word</strong></h2>
            </li>
            <li class="thirdAnimation">
                <h2><strong>Third Word</strong></h2>
            </li>
        </ul>
    </div>
</div>

Here's my CSS code for the animation:

.slider {
    max-width: 300px;
    height: 200px;
    margin: 20px auto;
    position: relative;
}
.slide1,.slide2,.slide3,.slide4,.slide5 {
    position: absolute;
    width: 100%;
    height: 100%;
}
.slide1 {
    background: url(http://media.dunkedcdn.com/assets/prod/40946/3.jpg)no-repeat center;
    background-size: cover;
    animation:fade 8s infinite;
    -webkit-animation:fade 8s infinite;

} 
.slide2 {
    background: url(http://media.dunkedcdn.com/assets/prod/40946/3.jpeg)no-repeat center;
    background-size: cover;
    animation:fade2 8s infinite;
    -webkit-animation:fade2 8s infinite;
}
.slide3 {
    background: url(http://media.dunkedcdn.com/assets/prod/40946/3.jpg)no-repeat center;
    background-size: cover;
    animation:fade3 8s infinite;
    -webkit-animation:fade3 8s infinite;
}
@keyframes fade
{
    0%   {opacity:1}
    33.333% { opacity: 0}
    66.666% { opacity: 0}
    100% { opacity: 1}
}
@keyframes fade2
{
    0%   {opacity:0}
    33.333% { opacity: 1}
    66.666% { opacity: 0 }
    100% { opacity: 0}
}
@keyframes fade3
{
    0%   {opacity:0}
    33.333% { opacity: 0}
    66.666% { opacity: 1}
    100% { opacity: 0}
}

The animation works fine on IE10, Firefox, and Opera, but it's not functioning properly on Chrome. I've tried to implement the code from this source. Any constructive suggestions would be greatly appreciated. Thank you in advance.

Answer №1

Do you find this example to be suitable for your needs?

HTML:

<div id="slider" style="width: 230px; height: 150px; padding:5px">
<div id="mask">
    <ul style="list-style:none;">
        <li class='firstAnimation slide1'>
            <h2>First Word</h2>
        </li>
        <li class="secondAnimation slide2" style="color: red;">
            <h2><strong>Second Word</strong></h2>
        </li>
        <li class="thirdAnimation slide3">
            <h2><strong>Third Word</strong></h2>
        </li>
    </ul>
</div>
</div>

CSS:

.slide1 {
animation:fade1 1s infinite;
-webkit-animation:fade1 1s infinite;

} 
.slide2 {
    animation:fade2 1s infinite;
-webkit-animation:fade2 1s infinite;
}
.slide3 {
    animation:fade3 1s infinite;
-webkit-animation:fade3 1s infinite;
}
@keyframes fade1
{
  0%   {opacity:1}
  33.333% { opacity: 0}
  66.666% { opacity: 0}
  100% { opacity: 1}
}
@keyframes fade2
{
  0%   {opacity:0}
  33.333% { opacity: 1}
  66.666% { opacity: 0 }
  100% { opacity: 0}
}
@keyframes fade3
{
  0%   {opacity:0}
  33.333% { opacity: 0}
  66.666% { opacity: 1}
  100% { opacity: 0}
}

The current issue is with the markup in your CSS code. You have defined css animations for classes like slide1, slide2, slide3, but these classes are not present in your HTML code.

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

Background image on webpage failed to load

I've encountered an issue with a background image I downloaded for my website - it simply will not display. Here is the CSS code I am using: background-image: url(Resources/Icons/background-image.jpg); background-attachment: fixed; Even after tryin ...

Mobile devices offer a seamless vertical scrolling experience

Here is the HTML structure I am working with: <div> <a>..</a> <i>..</i> <a>..</a> <i>..</i> <a>..</a> <i>..</i> </div> On larger screens, all elements are dis ...

Display or conceal image description upon mouseover

Attempting to create a portfolio page with images and implementing jquery to display and animate the captions on hover. However, when I attempted to do so, it didn't work with the code I have. The code snippet is provided below for reference. Snippet ...

Generate a menu submenu allowing for interactive toggling and dynamic visualization of expandable/collapsible sections upon clicking, featuring visually

Looking for assistance in creating a dynamic menu with sub-menus that can expand upon clicking. The goal is to have an expandable menu structure where the user can click to expand or collapse certain sections. However, my current code is not functioning co ...

Turn off base64 encoding for background URLs in the Minify package

When I use the minify tool to compress my js and css files, I noticed that the files containing background:url(...) statements actually increased in size. This happened because the urls were encoded to base64. I tried to disable this base64 encoding featu ...

CSS: Styling different <a href> tags to appear uniform within identical size containers

I currently have some links displayed on my webpage. These links are encapsulated within a border and have a background set for them, essentially creating a box around each one. <!DOCTYPE html> <style> a { background: #DDD; border: #BB ...

What is the best way to align an Icon in the navbar-toggler of Bootstrap 5?

When working with Angular and Bootstrap to develop a navigation bar, I encountered an issue with aligning a user icon in the navbar. The picture below shows the problem that arises when trying to center align the user icon among other links in the navbar. ...

Is there a way to align the line under the hyperlinks to match the text size using CSS?

<div className={styles.container}> <ul className={styles.links}> <li className={styles.link}> <a href="/">Home</a> </li> <li className={styles.link}> <a href="/portfolio& ...

Extract HTML content from a newly opened Chrome tab using Python

I'm currently attempting to extract the HTML code from a newly opened chrome tab, but so far my Python attempts have been unsuccessful. Below is what I have experimented with: I initially utilized the requests module, however when running the follow ...

Tips for positioning elements in a way that prevents CSS fixed from overlapping upon page loading

Is there a way to adjust my navigation menu to prevent overlap upon page load, but have it overlap when scrolling down (Dynamic nav bar)? Check out my current setup: Upon initial page load, the navigation bar overlaps the text. I would like the navigatio ...

Troubleshoot: Issue with Multilevel Dropdown Menu Functionality

Check out the menu at this link: The issue lies with the dropdown functionality, which is a result of WordPress's auto-generated code. Css: .menu-tophorizontalmenu-container { margin: 18px auto 21px; overflow: hidden; width: 1005px; ...

Enhancing text visibility in dompdf by making it bold or increasing its size

Recently, I began using dompdf v0.6.0beta3 along with the dompdf Codeigniter helper in Codeigniter. To address the issue of missing fonts, I manually moved the Arial font family tff files from the Windows 7 font folder to the /lib/fonts directory within do ...

When hovering over the menu, the sub-menu is displayed and the content slides downwards. Is there a way to prevent the content from sliding down and have the sub-menu overlap the

When the main menu is hovered over, a sub-menu appears and the content below the main menu slides down. Check out the code snippet below: HTML: <div id="holderDiv"> <div id="menu"> <a href="#" id="items">Menu 1</a> < ...

What is the best way to make all <li> elements appear on one line above, regardless of the content within each <li>?

Is there a way to align all li elements on the same line regardless of their content? Check out this screenshot for reference: ? The main issue I'm facing is that when I try to code it, the content within each li element shifts the other lis like thi ...

Create a unique margin using CSS only that will appear at the bottom of a flex-row container that scrolls

I'm trying to create a horizontal scroller with margins between each item and consistent margins at both ends. However, I'm noticing that the margin at the end of the container seems to be disappearing somehow. Is there a way to maintain the mar ...

Reduce the page zoom to 75% without changing the page layout

I am looking to implement a forced zoom out feature on a webpage, reducing the overall size to 75%. Unfortunately, I am unable to disclose the specific code as it belongs to the company I work for. Despite researching various methods online, including solu ...

Tips for showcasing the chosen menu item in the toggle button of the Bootstrap framework

I have created a collapsible menu that is hidden when the browser is resized and should be displayed when the button is toggled. Currently, I am using glyphicon-humberger in the toggle button. However, I would like to show the selected menu in the button ...

A pair of buttons each displaying a unique div block

I am facing an issue with my jQuery script. I want to be able to click on one of the previewed text associated with a button and then have the other one close automatically. The desired effect is for the text to slide down using slideDown() and disappear ...

Incorrect column alignment in Tailwind CSS

I am working on a straightforward flexbox layout with a two-column grid setup. <div class="flex relative"> <div class="columns-2 gap-4 space-y-4"> <div class="bg-red-500 p-10">1</di ...

Combining CSS Modules with Ant Design in ReactJs results in compatibility issues

Struggling to implement CSS Modules for styling in my ReactJs project, I followed the ant design documentation found here: . Unfortunately, it's not working as expected when trying to override the component styles of an ant Button. Below is a snippet ...