Safari keyframe animation causing wobbly off-center rotation

When viewed on Safari, the spinning animation appears off-center. How can this issue be resolved?

The CSS code responsible for the animation is as follows:

html, body {
     height: 100%;
}
 body {
     background: #a6b8b1;
     display: grid;
     place-content: center;
     grid-gap: 2rem;
}
 .link {
     width: 10rem;
     height: 10rem;
     display: inline-block;
     font: 300 1.55rem/1.4 "Josefin Sans";
     text-transform: uppercase;
     letter-spacing: 0.1175em;
     word-spacing: 0.3em;
     text-decoration: none;
}
 .link__svg {
     width: 100%;
     height: auto;
     transform-box: fill-box;
     fill: #2b3338;
     stroke: #2b3338;
     stroke-width: 0.05em;
     stroke-linecap: round;
     stroke-linejoin: round;
}
 .link__cloud {
     transform-origin: 50% 50%;
     animation: rotate normal infinite 60s linear;
     fill: rgba(255, 255, 255, 0.15);
}
 .link__face, .link__arrow {
     transform-origin: 50% 50%;
     transition: transform 0.15s cubic-bezier(0.32, 0, 0.67, 0);
}
 .link:hover .link__face, .link:hover .link__arrow {
     transform: scale(1.1);
     transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}
 .link__arrow {
     stroke-width: 0.075em;
}
 .link__text {
     animation: rotateReverse normal infinite 20s linear;
     transform-origin: 50% 50%;
}
 .link:hover .link__text {
     animation-play-state: paused;
}
 .link--alt {
     font-size: 1.15rem;
     letter-spacing: 0;
     word-spacing: 0;
}
 @keyframes rotate {
     to {
         transform: rotate(360deg);
    }
}
 @keyframes rotateReverse {
     to {
         transform: rotate(-360deg);
    }
}
 

To see the complete HTML setup and SVG elements for the rotating link animation, visit the original source at: https://codepen.io/natszafraniec/pen/eYMPEaM

Answer №1

Safari's default behavior or interpretation of the transform-origin property can differ, especially when working with SVGs, compared to other web browsers.

After reviewing the documentation for transform-origin on Safari, it appears that support is limited to version 9. This limitation can lead to issues. You may want to try setting the transform-origin to center instead of 50% in both dimensions, which seems to have resolved the issue for me. If that doesn't work, I suggest setting the transform origin to transform-origin: 100px 100px;, especially if your viewbox is 200x200 in size

<svg viewBox='0 0 200 200' width='200' height='200'

Codepen example using 100px

Codepen example using center

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

Instructions on keeping a numerical counter at its current value for all site visitors

Recently, I integrated a number counter into my website. However, I am facing an issue where the count resets to zero whenever a new visitor accesses the site. I'd like the count to remain persistent and update based on the previous count. For instanc ...

Leveraging functions with Ng-Repeat

I am currently dealing with two different arrays of objects. The first array contains a list of permissions groups, while the second array consists of user groups. My main goal is to compare the Group Owner (which is represented by ID 70) with the list of ...

Library for HTML styling in JavaScript

Is there a reliable JavaScript library that can automatically format an HTML code string? I have a string variable containing unformatted HTML and I'm looking for a simple solution to beautify it with just one function call. I checked npmjs.com but co ...

Enhancing CSS and HTML: Increasing the Border Color of Dropdown Menus and Utilizing Multiple Words per Dropdown Item

https://i.sstatic.net/ZI8Ch.png CODE div.box { display: block; text-align: center; margin: auto; z-index: 5 } #navMenu { margin: 0; padding: 0; } #navMenu ul { margin: 0; padding: 0; line-height: 30px; } #navMenu li { margin: 0; padding: 0; list- ...

The background image stubbornly refuses to stretch to the full width of the section container

Looking at my code example and the screenshot provided, it's clear that the image is not fitting into the container even when set to 100% width or utilizing other properties. Below you will see the code snippet: .about-us{ background-image: url(i ...

The application of CSS rule shadowing is not consistently enforced

Why does the text in the selected element not appear yellow like the "char_t" link above, even though they have the same class? It seems like it should be yellow based on the inspector, but it's not displaying as such on the actual page. This issue is ...

Tips for exchanging divs in a mobile view using CSS

Illustrated below are three separate images depicting the status of my divs in desktop view, mobile view, and what I am aiming for in mobile view. 1. Current Status of Divs in Desktop View: HTML <div id="wrapper"> <div id="left-nav">rece ...

Creating a Loop for Tabs on an HTML Form

When navigating through form input boxes using the tab key, it usually goes in order. However, I discovered that you can actually customize this order by using tabindex=x. Since I have 5 inputs on my form, I use tabindex 5 times to specify the order. But ...

Learn how to use Angular2 or TypeScript to display 'unsubscribe' and 'subscribe' text on a toggle button

I'm working on a toggle button that initially displays the word subscribe on the thumb. When the toggle is disabled, I want it to show unsubscribe instead. Can someone please help me achieve this functionality? Here's the code snippet: <md-s ...

I'm curious if there is a contemporary alternative to "Deep Zoom Composer" in Silverlight that enables the creation of panoramic images by stitching multiple images together

There was a time when Silverlight offered a feature known as "deep zoom", which cleverly adjusted bandwidth usage as the user zoomed in and out. Recently, I discovered a unique application for this technology - by incorporating images taken from a hot air ...

Creating a grid layout by designing boxes using CSS and HTML

I'm in the process of creating a homepage and I'd like it to resemble this design: (not the best quality, but the software I used was subpar (I miss mspaint)) Originally, I used buttons which made linking and customization easy, but I encounter ...

Exploring the versatility of CSS variables in JavaFX

In need to style four buttons in a consistent way, but each one should have its own unique image. Three styles are required: one for normal state, and the others for hover and focused states. Using CSS for this task would involve a lot of repetition, as ...

Resizing with Jquery results in sudden movement

I have used jQuery to create a set of buttons inside a <ul> element. I am now attempting to resize the <ul> by adding a handle to the top of it, but when I try to resize it, the element jumps as shown in the images below. What could be causing ...

Resize the div based on the width and height of the window

My goal is to create a system or website that can be fully resizable using CSS and the VW (viewport width) unit. Within this system, I have integrated a GoogleChart that functions with pixels. Now, I am looking for a way to scale the chart using Javascript ...

What is preventing the function from successfully compiling text from various files that are uploaded using the HTML5 file reader into an array?

My current challenge involves attempting to upload two text files using the HTML 5 file reader. While I can successfully get the files into an array, encountering difficulty arises when trying to return that array from the function. One solution could be ...

Update the image source when hovering over the parent element

Check out this snippet of HTML code: <div class="custom text-center threeBox ofsted"> <a class="ofsted" title="ofsted report" href="http://reports.ofsted.gov.uk/"> <img class="text-center ofstedLogo" src="images/ofsted_good_transparen ...

How can you inform TypeScript about a file that will be included using a script tag?

I am currently utilizing TypeScript for my front-end JavaScript development, and I have a situation where I am loading two scripts from my index.html file as shown below: <script src="replacements.js"></script> <script src="socket.js">&l ...

Creating square elements using only HTML and CSS

This is just a longer text to demonstrate multiple lines being centered. ...

Utilizing the :after pseudo-element for placing text in a specific location

Here's the code I'm working with: div#myImg{ background: url('myimage.png') left top no-repeat; } div#myImg:after{ content: 'TEXT UNDER IMAGE'; margin:0 auto; vertical-align:text-b ...

Tips for adjusting the width of a table

add your image description hereImagine a scenario where there is a table featuring two columns. <table> <tr><td>Email</td> <td></td></tr> <tr><td>Full name</td> <td></td></tr> ...