CodexBloom - Programming Q&A Platform

CSS transitions optimization guide on pseudo-elements in Chrome 95

👀 Views: 42 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-15
css chrome transitions pseudo-elements CSS

I'm confused about I'm trying to figure out I'm not sure how to approach I tried several approaches but none seem to work........... I'm experiencing an scenario where CSS transitions on pseudo-elements are not functioning as expected in Chrome version 95. I have a simple button where I want to change the background color of a `::before` pseudo-element on hover. However, the transition effect is not smooth, and it appears to jump directly to the new color instead of transitioning. I've tried applying the `transition` property directly on the `::before` pseudo-element, but that doesn't seem to help. Here's the code I'm using: ```css .button { position: relative; padding: 10px 20px; background-color: #3498db; color: white; border: none; cursor: pointer; outline: none; } .button::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(52, 152, 219, 0.5); transition: background-color 0.3s ease; z-index: -1; } .button:hover::before { background-color: rgba(52, 152, 219, 1); } ``` I've also tested this in Firefox and it works perfectly. I even tried adding the `will-change` property to the `::before` element to optimize performance, but that hasn't resolved the scenario either. Is there a known bug with Chrome, or am I missing something in my implementation? My development environment is macOS. Any help would be greatly appreciated! I'm using Css 3.11 in this project. Any pointers in the right direction? I'm developing on Debian with Css. I'm open to any suggestions.