Using keyframes for flexbox animation in Safari

What could be causing the issue with flex keyframes not working in Safari while functioning properly in other browsers?

<div class="a">
  <div class="b"></div>
</div>

.a {
  height: 200px;
  display: flex;
}

.b {
  flex:0 1 50%;  
  border: 20px solid red;
  animation: anim-b 1s infinite;
}

@keyframes anim-b {
    0% { flex:0 1 0%; }
    100% { flex:0 1 100%; }
}

Answer №1

When combining longhand and shorthand properties, animations can be finicky.

In this particular scenario, Safari has a glitch when animating flex-basis, and the issue persists in version 11.

To workaround this problem for the default row direction, you should use width instead.

Stack snippet

.a {
  height: 200px;
  display: flex;
}

.b {
  flex:0 1 auto;
  width: 50%;
  border: 20px solid red;
  animation: anim-b 1s infinite;
}

@keyframes anim-b {
    0% { width: 0%; }
    100% { width: 100%; }
}
<div class="a">
  <div class="b"></div>
</div>

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

How can a div be utilized to create a footer with two columns?

Is there a way to design a two-column footer using only divs and no tables? The dimensions of the footer are set at 980px and it needs to include... Copyright 2010 xyz.com (to be placed on the left side) About us | privacy | terms (to be placed on the r ...

Creating individual background colors for each nested child element is achievable by using CSS selectors and the nth

I want to create a reddit comment layout similar to this: <div> <div class="comment" style="background: white;"> <div class="comment" style="background: grey;"></div> <div class="comment" style="background: grey;"> ...

Tips for managing CSS/style conflicts in JavaScript/AngularJS applications

I am new to AngularJS and I have a requirement to assign CSS properties to a component at the JavaScript file level. When I debug my code after applying the CSS styles to the component, I can see that all the applied CSS properties are behaving as expected ...

What are the recommended practices for server-side Java when compiling CSS to SWF?

Users of my project have the ability to design custom CSS for our flexible application. When it comes to converting the CSS into SWFs on the server side: Is it recommended to utilize the flex2.compiler.css.Compiler class in mxmlc-3.5.0.12683.jar? Altern ...

The background color is not displaying correctly on the <div> element

body { background-color: #FFFDEC; } .header { position: fixed; top: 0; left: 0; height: 50px; width: 100%; background-color: #04A7A6; margin: 0; display: block; z-index: 10; } .headermenu { xposition: fixed; ...

Is the Addthis widget displaying incorrectly in a fixed element?

I'm currently using addthis as a vertical toolbox with the hover popup feature on a fixed element. However, when scrolling, the popup appears in a different location. I've tried adjusting the offset top and left configurations, but they haven&apo ...

"Unable to display image" for an image created by PHP within CSS/JavaScript

In my Laravel site, I have the following code snippet inside a controller: serveAngledImage($session,$imgId,$angle) { [...] $maskExists =\Storage::disk('s3')->exists($usrDirectory.$maskFile); $maskUrl = \Stor ...

Unveiling the hidden div with a direct URL trigger

I am currently working on a small webpage that consists of three sections. Only one section is displayed at a time while the others remain hidden. The welcome section is shown by default when the page loads, and the rest are set to display:none. By clickin ...

How can I retrieve the offset top of a td element in relation to its parent tr element?

Here is some sample dummy HTML code: <table> <body> <tr> <td id="cell" style="height: 1000px; width: 200px;"></td> </tr> </body> </table> I am looking to attach a click event ...

Tips for creating a textarea element that resembles regular text format

I am working on creating an HTML list that allows users to edit items directly on the page and navigate through them using familiar keystrokes and features found in word processing applications. I envision something similar to the functionality of To achi ...

The dropdown menu is not appearing in the correct position when clicked

https://i.stack.imgur.com/fMyZQ.jpg Hello there, this link appears normal before clicking on it. But once clicked, it moves to the top of the page like so: https://i.stack.imgur.com/yZ0R0.jpg You can clearly see the difference. I have also provided the c ...

Utilizing both a primary and secondary font in the Flying Saucer PDF generator for optimal document appearance

I'm struggling with getting flying saucer to utilize a secondary font for the characters that are not included in my main font. The Java code I am currently using looks something like this: String result = getPrintHtmlContent(urlString); res ...

Creating an image using tiles in HTML

I have divided an image into 48 tiles (8x6) using a method similar to "Cutting an Image into 9 pieces C#". Now, I want to reconstruct the original image in HTML. What is the most effective approach to achieve this? Initially, I attempted to use a table wi ...

Shooting star css animation featuring pre and post effects

Trying to create a falling star using CSS animation. I made a star with a pseudo element, but I'm having trouble setting the animation in the pseudo-element. i{ position: relative; width: 0; height: 0; border-left: 12px solid transpa ...

What is the best way to access bootstrap col and row styles without needing to import the entire framework?

I am currently in the process of developing a react app using styled-components and I am looking to design a component that mimics the functionality of the col col-x classes from bootstrap. Additionally, I also want to create another component for the row ...

What is the best method for efficiently wrapping contents within a div container?

On the website cjshayward.com/index_new.html, there is a div wrapped around the content of the body, which is approximately 1000 pixels wide. In Chrome and Firefox, the wrapper works perfectly for the top section of about 100 pixels. Further down the page, ...

Arranging various Materialize toasts at various locations on the screen [ v1.0.0 ]

My goal is to have a toast appear on the top-middle of the screen when an image is zoomed in, while all other normal toasts should display at their default position. I've been successful in showing the toast when zoomed in, but I'm having trouble ...

CSS - Negative Margins Leading to Horizontal Scrolling Issue in Mobile Viewport

I’m working on some HTML and CSS code that looks like this: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content= ...

What is the method to remove an element from visual transitions?

I have an Angular App version 17.3 and I recently enabled view transitions using the withViewTransitions() function. However, I am now facing a challenge in excluding a specific element from the default (root) view transitions. Is there a way to achieve t ...

Error Retrieving Video File in Flask: 404 Not Found Issue

I'm having trouble with displaying static files on my Flask website and would really appreciate some help since I don't have much experience in web development. Sorry if I'm not explaining clearly, but here's the issue: Problem: Whene ...