`The Safari browser showing glitches with CSS animations`

Despite using both the -webkit-animation and animation, my animation does not work in Safari, only in Chrome and Firefox. The CSS code I have utilized is displayed below:

.bar{
  height: 30px;
  max-width: 800px;
  margin: 0 auto 10px auto;
  line-height: 30px;
  font-size: 16px;
  color: white;
  padding: 0 0 0 10px;
  position: relative;
}
.bar::before{
  content: '';
  width: 100%;
  position: absolute;
  left: 0;
  height: 30px;
  top: 0;
  z-index: 0;
  background: #ecf0f1;
}
.bar::after{
  content: '';
  background: #7CE1C9;
  height: 30px;

  display: block;
  width: 100%;
  -webkit-animation: bar-before 1 1.8s;
  animation: bar-before-two 1 1.8s;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}
@-webkit-keyframes bar-before{
  0%{
    width: 0px;
  }
  100%{
    width: 100%;
  }
}
@keyframes bar-before-two {
  0%{
    width: 0px;
  }
  100%{
    width: 100%;
  }
}

I am stumped on why this doesn't work on Safari but works on other browsers. Any suggestions would be greatly appreciated!

Answer №1

Two animation names, bar-before and bar-before-two, were not properly prefixed. Consider merging them into one - progress-bar, or set them individually.

-webkit-animation: progress-bar 1.8s;
animation: progress-bar 1.8s;

@-webkit-keyframes progress-bar{
  0%{
    width: 0px;
  }
  100%{
    width: 100%;
  }
}
@keyframes progress-bar{
  0%{
    width: 0px;
  }
  100%{
    width: 100%;
  }
}

.bar{
  height: 30px;
  max-width: 800px;
  margin: 0 auto 10px auto;
  line-height: 30px;
  font-size: 16px;
  color: white;
  padding: 0 0 0 10px;
  position: relative;
}
.bar::before{
  content: '';
  width: 100%;
  position: absolute;
  left: 0;
  height: 30px;
  top: 0;
  z-index: 0;
  background: #ecf0f1;
}
.bar::after{
  content: '';
  background: #7CE1C9;
  height: 30px;
  display: block;
  width: 100%;
  -webkit-animation: progress-bar 1.8s;
  animation: progress-bar 1.8s;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}
@-webkit-keyframes progress-bar{
  0%{
    width: 0px;
  }
  100%{
    width: 100%;
  }
}
@keyframes progress-bar{
  0%{
    width: 0px;
  }
  100%{
    width: 100%;
  }
}
<div class="bar">bar</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

Retrieve text from an element using jQuery when triggering "mouseenter" on a different element

Is there a way to retrieve the text from an element while simultaneously triggering a 'hover' action on another element? Here is an illustration: I am trying to gather all available colors, but the color names are only visible upon hovering ove ...

Use CSS3 to hide the <li> elements initially and make them appear when the <li> is clicked on

Click here How can I hide the "subline" line from the list and make it visible when the user clicks on the "sub" line, pushing the other lines down? I'm hoping for a solution that doesn't involve using Js or JQuery. Thank you in advance! ...

What is the best way to display the content below a bootstrap card while utilizing relative positioning?

Currently working on a bootstrap card design featuring an image. With the card body positioned above the image using position: absolute and top. The challenge arises when adding a new div below the card; it ends up being pushed onto the image instead of s ...

Reorganize HTML elements for improved responsiveness on various devices

Looking for a CSS-only solution to move an element under specific conditions based on width breakpoints. Breakpoints are already defined in the stylesheets for mobile styling, but need the icon to display below content at certain widths. The page display ...

Tips on using javascript to reset an element's inline CSS to its initial default styling?

I have a basic function that alters the default text styling when a checkbox is checked, and restores it to its original state when the checkbox is unchecked. Despite my efforts, the terms.style = ""; line does not reset the style as expected. I am perple ...

Guide to eliminating the arrow from a dropdown menu in Bootstrap 4

I am working with Bootstrap 4 and attempting to eliminate the dropdown arrow in my design. Unfortunately, the solutions that were effective for Bootstrap 3 no longer apply. You can read more about this issue here. To see the problem in action, check out ...

How to achieve horizontal auto-scrolling in an image gallery with jQuery?

Hey there, I'm currently working on an Image Gallery project. I have arranged thumbnails horizontally in a div below the main images. Take a look at this snapshot img. My goal is to have the thumbnails scroll along with the main pictures as the user ...

Arranging Elements Individually Using Bootstrap 4 in a Row or Column

Utilizing Bootstrap 4, I am designing a row with two items placed in a column. The first item should always be aligned to the left of the row, while the second item is centered within the row. I have successfully achieved this layout using custom CSS. Is i ...

Tips on eliminating the gap between two flex items while adjusting their size

Can anyone assist me with my code? Here is the current version: https://i.stack.imgur.com/00RGC.png I want it to resemble this: https://i.stack.imgur.com/JSclD.png You can find all my attempted media queries in the CSS comments at the end. Please let m ...

AngularJS cube animation tutorial

I utilized this particular inquiry to develop a cube controller. Here's my progress so far. To initiate the animation, I am employing ng-if and ng-include. <div ng-repeat='view in views' class='cube container'> <div ...

Unable to eliminate italicized text within collapsible content

Despite having no programming experience, I am attempting to create a FAQ section for our help site using collapsible sections for the Q&A. While I've managed to achieve most of what I wanted, there is one element that stubbornly refuses to change. De ...

Is the container in semantic ui being breached by a segment overflow?

I've recently started learning Semantic UI. One issue I'm facing is that the width of the "segment" overflows the "container." Check this JSFiddle for more clarity. Are there any alternative solutions? In addition to the grid system, I'm ...

Tips for creating consistent spacing between elements using Tailwind CSS version 3

I am currently utilizing Tailwind CSS in conjunction with next.js for my project. I have a total of 8 images, each varying in size, and my goal is to display 4 images per row on medium and large devices, while displaying 2 images per row on small devices. ...

Is it possible to adjust the width of Material-UI TextField to match the width of the input text?

Is there a way for Material-UI to adjust the width of the TextField element automatically based on the input text? When creating a form view/edit page and rendering data into fields, I also have parameters set by the server. It would be convenient to have ...

It seems that using the SVG <mask> tag is necessary for Firefox to display correctly, but it causes issues with CSS mask in

I need assistance with masking content using an external SVG image. Currently, I'm using the following code: #homepage-banner .desktop-slider.masked { -webkit-mask:url(news-panel-mask.svg) left top no-repeat; /* Chrome/Safari (Webkit) */ mask: ur ...

Using React js to create a blurred background effect when an input field is in focus

I would like to implement an input field similar to the one shown in the image. When the input field is clicked on, I want to blur the background. image example Do I need to use a specific library for this? Currently, I am using Material UI. ...

Material-UI Grid in Full Width Mode is malfunctioning

I've been delving into the Material-UI@next grid layout system to grasp its intricacies. What I'm aiming for is to have two papers that stretch across the entire width of the screen and collapse into one paper when the screen size shrinks. The d ...

Exploring the effects of zooming on YouTube videos in Firefox

Strange phenomenon, but my website appears to be having display issues specifically on Firefox. Surprisingly, it looks perfectly fine on IE9, Safari, and Chrome. The layout of the site in Firefox seems to change when I zoom in or out, resulting in the You ...

Tips for positioning bootstrap dropdowns side by side in a row

I'm having trouble aligning my li items in a Bootstrap dropdown next to each other. I've tried everything but nothing seems to work. Here's my code: <nav class="navbar navbar-expand-lg navbar-light bg-light"> < ...

Ensure that when you click on the next dropdown menu opener button, the previous dropdown menu closes and only the new menu remains open

Take a look at this page first to get an understanding: On this page, I have implemented multiple dropdown menus that should open when clicked on their respective opener buttons (3 bar icon) and close either when clicked again or anywhere else on the page ...