Issues with CSS3 keyframe animations failing to function in Firefox and IE

My CSS code is functioning properly in Chrome and Safari, but not in Firefox, IE, and Opera when I create the @keyframes rotate {}. It seems that these 4 lines might be causing the issue:
animation-duration: 4s;

animation-timing-function: linear;

animation-name:"rotate";
animation-iteration-count: infinite;

Is it due to these lines or the keyframe method itself? How can I resolve this?

CSS:

@-webkit-keyframes rotate {
        /* Keyframe animations for Webkit browsers */
    }

    /* Keyframe animations for Firefox */
    @-moz-keyframes rotate {
        /* Keyframe animations for Firefox */
    }

    /* Standard keyframe animations */
    @keyframes rotate {
        /* Standard keyframe animations */
    }

    /* Keyframe animations for Internet Explorer */
    @-ms-keyframes rotate {
        /* Keyframe animations for IE */
    }

    /* Keyframe animations for Opera */
    @-o-keyframes rotate {
        /* Keyframe animations for Opera */
}
    

Answer №1

To make the animation work, simply remove the double quotes from the animation name (rotate instead of "rotate").

Here is a link to a running demo:

Check out the demo

-webkit-animation-duration: 4s;
-webkit-animation-timing-function: linear;
-webkit-animation-name:rotate;
-webkit-animation-iteration-count: infinite;

-moz-animation-duration: 4s;
-moz-animation-timing-function: linear;
-moz-animation-name:rotate;
-moz-animation-iteration-count: infinite;

-ms-animation-duration: 4s;
-ms-animation-timing-function: linear;
-ms-animation-name:rotate;
-ms-animation-iteration-count: infinite;

-o-animation-duration: 4s;
-o-animation-timing-function: linear;
-o-animation-name:rotate;
-o-animation-iteration-count: infinite;

animation-duration: 4s;
animation-timing-function: linear;
animation-name:rotate;
animation-iteration-count: infinite;

Make sure the non-prefixed properties are always placed after the vendor-specific ones for proper functionality.

P.S: If you're not familiar with it, there are tools available that can automatically add prefixes to your code before compiling (such as Prefixr) or even during runtime (like prefix-free).

By the way, I really like your animation, great job! :)

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

Efficiently reducing the size of a CSS selector string with javascript

Is there a library that already performs this function? I've only been able to find online tools. The reason I am interested in accomplishing this task using JavaScript is because I need to ensure that the strings a > b, a and a> b,a are conside ...

The Struggle with Bootstrap Accordion

I'm currently in the process of learning bootstrap. I copied the code for the 'Flush' Accordion from the bootstrap docs, but my version looks completely off. Despite linking the CSS stylesheet and JS Bundle, it doesn't seem to align pro ...

Transforming a traditional HTML/CSS/JS website into a cutting-edge React application using Tailwind CSS styling

I have a unique website template complete with HTML, CSS, and all necessary assets. Now, I am looking to develop a React JS application using this template. Firstly, I am wondering: Since I typically use Tailwind CSS for my other projects, would it be mo ...

Guidelines for organizing multiple checkboxes in a grid format

Hey there, I'm looking to create a 3x3 grid of checkboxes in a pop-up window. I found a similar example here: https://codepen.io/webdevjones/pen/qBapvrz. I tried using display: flex, but I'm unable to get the checkboxes in a grid format and the l ...

What could be the reason behind my table appearing all crammed up in a single

My table is appearing in a single cell, and I can't figure out what's wrong. Can someone please take a look and let me know where I messed up? <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" cont ...

Can you adjust the size of a container based on a breakpoint using a class name in Bootstrap 5?

I am currently working on styling a div using Bootstrap 5. I have a specific requirement where I want the container to have a width of 50 when the screen size is bigger than the medium breakpoint, and by default, it should have a width of 75. In Tailwind, ...

How can I adjust two overlapping divs for proper display?

It seems like I have two divs overlapping on the same line. The layout appears fine on a PC but not on an iPad or mobile device. Can someone please review the code and point out any mistakes I might have made? The issue is with the content overlapping the ...

Steps for aligning a grid column to the same height as the element above it and moving it to the left side

I have a setup using material UI where I have a grid positioned on top of a Paper element. Within the grid, there is a text input field in the first column that I want to match the height of the paper element and be aligned with its left border. I have tri ...

Having trouble figuring out how to load images into a div based on the current page location?

Looking for a solution to my problem - I have a navigation bar with a fixed div (A) on the far right side. The nav bar remains at the top of the page. There are 6 sections in the body of the page, each being 1200px tall divs. What I want is for a different ...

Tips for Properly Positioning Floating Pop-Up Messages Using CSS and jQuery

I was experimenting with adding a button that triggers a popup message to my website. I followed a coding tutorial using jQuery and CSS, which looks like this: Javascript : !function (v) { v.fn.floatingWhatsApp = function (e) {...} }(jQuery); CSS : .fl ...

As I go through the database, I notice that my div model functions correctly for the initial record but does not work for any subsequent ones

I came across a model on w3 schools that fits my requirements, but I am facing an issue where the model only works for the first result when looping through my database. It's likely related to the JavaScript code, but I lack experience in this area. C ...

What are the limitations preventing C++ applications from generating interfaces similar to those of PHP, HTML, and CSS?

I've always been puzzled by the fact that programming languages such as C++, Python, C, and others seem to be stuck in the realm of the command line. When building websites, I can easily use HTML, CSS, and PHP to quickly create both the logic and inte ...

The collapse menu toggle feature seems to be malfunctioning, as it is not functioning properly

I've been working on a website at , where the toggle menu is causing the content to hide when the menu is expanded. <aside id="layout-menu" class="layout-menu menu-vertical menu bg-menu-theme active"> <div class= ...

Creating responsive lines with CSS on top of an image

I would like to add lines on an image using CSS3 and HTML5 Canvas. I came across a tutorial and demo that utilizes an html div: However, when attempting this effect on an image, the line appears outside of the image. How can I ensure that the line is dra ...

Neglecting to review the CSS - embracing ejs layouts in Express

I am encountering an issue with the express ejs layouts where only the mainPage is able to read the CSS, while the other pages are unable to do so (even though the HTML reads it). Additionally, if I want to use another layout such as "layout2.ejs", what s ...

"Exploring the world of Reactstrap: A

I am struggling to understand the documentation for Bootstrap and reactstrap as I have never used them before. For example, changing the Navbar color and background opacity has been a challenge because they require reserved keywords to be passed as props, ...

The jQuery attr() method is universally compatible across platforms and stands independent

I have a jQuery statement that is currently working for me, but I am unsure if it is cross-platform independent. Can anyone confirm? $("input[name='confirmed']").attr("checked",false); It is functioning correctly on the latest version of Firefo ...

Leveraging the power of Bootstrap 4 to place the footer beneath all remaining content on the

I am currently working on a React application that consists of a header, container, and footer. To add animation to the route loading process, I had to apply position: absolute to the container section of the page. Within the container, there is a row wit ...

Is it possible to have a variable number of dynamic CSS Grid columns with the option of including a header or footer

Implementing a dynamic number of columns with CSS Grid is a breeze. .grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); } // These .cells are beautifully aligned <div class="grid"> <div class="cell"></div> ...

Only add table heading if there is available space, but refrain from doing so if it will disrupt the layout

My current challenge involves a table where I have successfully used white-space nowrap to prevent the heading text from wrapping. The issue arises when viewing the layout on smaller screen widths, as this nowrap setting causes the table to expand beyond ...