``There seems to be an issue with CSS Transform/Transition not functioning properly

Here is some CSS code that I used to animate a list of items on my website:


        selector {
            display: flex;
        }

        #primary li a {
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-image: linear-gradient(to right, #CF2E2E, #CF2E2E 50%, #000000 50%);
            background-size: 200% 100%;
            background-position: -100%;
            -webkit-transition: all 0.3s ease-in-out;
            -transition: all 0.3s ease-in-out;
            transition: all 0.3s ease-in-out;
            -o-transition: all 0.3s ease-in-out;
            -moz-transition: all 0.3s ease-in-out;
        }

        #primary li a:before {
            display: block;
            content: '';
            width: 0;
            height: 3px;
            bottom: 5px;
            left: 0;
            bottom: -3px;
            z-index: 0;
            position: absolute;
            background: #000;
             -webkit-transition: all 0.3s ease-in-out;
             -transition: all 0.3s ease-in-out;
             transition: all 0.3s ease-in-out;
             -o-transition: all 0.3s ease-in-out;
             -moz-transition: all 0.3s ease-in-out;
        }

        #primary li a:hover {
            background-position: 0%;
        }

        #primary li a:hover:before {
            width: 100%;
        }
    

However, this animation does not seem to work on Safari. Can anyone explain why and provide a solution? Any help or hints would be greatly appreciated!

Thank you, Jack

I have modified the CSS to exclude the problematic "transition: all" property but the issue persists:


        selector {
            display: flex;
        }

        #primary li a {
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-image: linear-gradient(to right, #CF2E2E, #CF2E2E 50%, #000000 50%);
            background-size: 200% 100%;
            background-position: -100%;
            -webkit-transition: 0.3s ease-in-out;
            -transition: 0.3s ease-in-out;
            transition: 0.3s ease-in-out;
            -o-transition: 0.3s ease-in-out;
            -moz-transition: 0.3s ease-in-out;
        }

        #primary li a:before {
            display: block;
            content: '';
            width: 0;
            height: 3px;
            bottom: 5px;
            left: 0;
            bottom: -3px;
            z-index: 0;
            position: absolute;
            background: #000;
             -webkit-transition: 0.3s ease-in-out;
             -transition: 0.3s ease-in-out;
             transition: 0.3s ease-in-out;
             -o-transition: 0.3s ease-in-out;
             -moz-transition: 0.3s ease-in-out;
        }

        #primary li a:hover {
            background-position: 0%;
        }

        #primary li a:hover:before {
            width: 100%;
        }
    

Answer №1

Unfortunately, I don't have access to Safari to test if this code is functional:

selector {
    display: flex;
}
#primary li a {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(to right, #CF2E2E, #CF2E2E 50%, #000000 50%);
    background-size: 200% 100%;
    background-position: -100%;
    -webkit-transition: background-position 0.3s ease-in-out;
    -transition: background-position 0.3s ease-in-out;
    transition: background-position 0.3s ease-in-out;
    -o-transition: background-position 0.3s ease-in-out;
    -moz-transition: background-position 0.3s ease-in-out;
}
#primary li a:before {
    display: block;
    content: '';
    width: 0;
    height: 3px;
    bottom: 5px;
    left: 0;
    bottom: -3px;
    z-index: 0;
    position: absolute;
    background: #000;
    -webkit-transition: width 0.3s ease-in-out;
    -transition: width 0.3s ease-in-out;
    transition: width 0.3s ease-in-out;
    -o-transition: width 0.3s ease-in-out;
    -moz-transition: width 0.3s ease-in-out;
}
#primary li a:hover {
    background-position: 0%;
}
#primary li a:hover:before {
    width: 100%;
}

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

Styling code for a layout with two columns aligned to the left using

I am looking to create a layout where two pieces of text are displayed side by side in columns using CSS. The left-hand column will have variable length text, while the right-hand column will have fixed length text. The desired layout should show the two ...

The elements within the flexbox are being truncated when viewed on smaller devices

I have encountered an issue with my code where the .content element, which has flex properties, appears cut off on small screens. I want to avoid setting a fixed size because the text within it may vary in size. The goal is for the background image to fi ...

How to position footer at the bottom of Material UI cards - see example below

After getting inspiration from the material-ui example of cards, I wanted to create a grid layout with multiple cards. My goal was to make all the cards have equal height (which I achieved using height:100%) and position the footer at the bottom of each ca ...

Can you direct me to resources on the internet that provide information about support for 12 Bit color depth?

I am curious to know when the w3specs will support colors in 12 bits instead of the current 8-bit format used for webcolors like sRGB (#FFFFFF or rgba(255,0,0,100). I wonder if there will ever be a new standard called 12-Bit sRGB where colors can be defin ...

Unlimited Possibilities in Designing Shared React Components

Seeking the most effective strategies for empowering developers to customize elements within my React shared component. For example, I have a dropdown and want developers to choose from predefined themes that allow them to define highlight color, font siz ...

I need help with customizing the progress bar in HTML and CSS

How can I create a progress bar like the one shown below: .detail-load { height: 42px; border: 1px solid #A2B2C5; padding: 1px; border-radius: 10px; } .detail-load > .detail-loading { background: #904BFF; height ...

How can you create a jQuery fade in effect for a single <li> element

I'm in the process of developing a task management app that generates a new li element every time a user adds an item. However, I am facing an issue where fadeIn() is activating for every li on the page whenever a new item is added. Does anyone have s ...

What are the steps to create a dynamic navigation bar in React without encountering hydration issues?

My goal is to dynamically show or hide links based on user authorization. Here's my initial approach: const Navbar = () => { const { canDo, ...} = useUser(); //A Zustand store return ( <> <div> <ul> ...

Switch up image transitions using Javascript

I have already completed the css and html structure for my project. However, I am encountering issues with the JavaScript functionality. I really like the image effect on this website: (the blue one). I have attempted to replicate it here: , but have bee ...

Basics of CSS border-image explained

Although it seems simple, I'm struggling to figure out what the issue might be. I am attempting to create a div with a specific border on an ASP.Net webpage. CSS: .ResourcesDiv { border-image:url(http://blogrope.com/wp-content/uploads/2013/06/003-w ...

Content that is set to a fixed position within a hidden element will remain at the top

translate3d(0%, 0px, 0px); is causing issues with my position fixed element. In my demo, you'll notice that clicking the button should open up the content just fine, but it is supposed to stay fixed at the top in a position fixed. Therefore, when scr ...

Utilizing React JS: Displaying or Concealing Specific Components Based on the URL Path

Is there a way to dynamically change the navbar items based on the URL without having separate navbar components for each side? My current navbar design features 3 links on the left side and 3 links on the right, but I want to display only one side at a ti ...

"Enhance Your Website with Dynamic Text Effects using JavaScript

Is there a way to continuously animate text during the loading process of an AJAX request? I've tried implementing various methods, such as using a setTimeout function or an infinite loop, but nothing seems to work for repeating the animation once it& ...

overlapping text placed directly above another text

Is there a way to place a text fragment above another part of the same line? <div>Th<div class="ac">Am</div>is is an ex<div class="ac">E</div>ample line</div> If implemented, it should display as: Am E This ...

Pair objects that possess a specific attribute

I have a HTML snippet that I want to modify by adding the CSS class HideEdit to hide specific columns. <th class="rgHeader" style="text-align: left;" scope="col" _events="[object Object]" control="[object Object]" UniqueName="Edit"> This particular ...

The image is not properly aligned with the background image

I'm currently working on a page design using bootstrap and css where I want images to fade and reveal the background when hovered over. The challenge I'm facing is that although all images are set to 100px in size, there is white space visible ar ...

Accessing a JSON value in SCSS for localization

I have a JSON file containing all the values that I want to use for internalization in my app. On the HTML side, I am able to retrieve the values, but on the CSS side, I am using a "before" pseudo-element. In my HTML, I am using the class "menu-input" li ...

Troubleshooting Material-UI Menus

I need the menu to adjust its height dynamically as the content of the page increases vertically. Even though I have applied "height:100%" in the styles, it doesn't seem to work. Can anyone assist with this issue? Here is the code snippet: import R ...

How CSS can affect the layout of elements on a webpage

I am looking to achieve something similar to this: The left box should maintain a fixed width, while the right one resizes to fit the full width of the browser window. I also need the height of both boxes to be resizable. Apologies for any inconvenience ...

Aligning two lines next to a radio button using HTML and CSS

I'm facing a challenge where I want to align two lines in the middle of a radio button. Despite my efforts, I am able to line up the top line but struggling with the bottom one. I prefer not floating the radio button as it's being styled using a ...