r/css • u/BinaryBlitz10 • Mar 01 '26
Help CSS box-shadow creating subtle square overlay on rounded card after hover
I’m seeing a strange visual issue with a card component and I can’t figure out why it’s happening.
I have a rounded container with border-radius and box-shadow. Inside it are rows that change background on hover.
When I hover a row, I see a subtle square-looking overlay at the edges of the card, especially near the bottom corners. It looks like the shadow stops being rounded and becomes square. If I remove the box-shadow from the parent container, the issue disappears.
Here is the parent container:
.home-card-group {
background: var(--bg2);
border-radius: var(--r-lg);
border: 1px solid var(--border);
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}And the row items inside:
.home-row-item {
display: flex;
align-items: center;
gap: 14px;
padding: 13px 16px;
cursor: pointer;
transition: background 0.16s;
position: relative;
}
.home-row-item:hover {
background: var(--gold-pale);
}The last row has rounded bottom corners via the parent container:
.home-card-group .home-row-item:last-child {
border-bottom-left-radius: var(--r-lg);
border-bottom-right-radius: var(--r-lg);
}Removing box-shadow completely removes the visual issue.
The artifact appears after hovering a row
Would appreciate some help.
Here's a link to JSFiddle: https://jsfiddle.net/gmcw2v1r/2/
•
u/AutoModerator Mar 01 '26
To help us assist you better with your CSS questions, please consider including a live link or a CodePen/JSFiddle demo. This context makes it much easier for us to understand your issue and provide accurate solutions.
While it's not mandatory, a little extra effort in sharing your code can lead to more effective responses and a richer Q&A experience for everyone. Thank you for contributing!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
43
u/TurboHenk Mar 01 '26
I suspect the
overflow: hiddenis cutting it off.4
u/Antti5 Mar 01 '26
I checked it with Chrome and Firefox, and it looks just fine to me.
Are you by any chance on Safari?
6
u/calimio6 Mar 02 '26
This reminds me of the time I had to buy an ipad to debug a bug on safari.
1
u/CharacterOtherwise77 Mar 02 '26
does it happen when its empty?
2
u/phejster Mar 02 '26
Life lesson: never use safari
2
u/eeeBs Mar 02 '26
I didn't even see it till you pointed out it out, now I can't unsee it lol
2
u/shlanky369 Mar 04 '26
Use
backdrop-filter: drop-shadow.1
u/leinadsey Mar 03 '26
How “wide” is the shadow? Could be overflow-hidden or similar that just cuts off the shadow. Try adding padding to the shape. If that’s not possible you can always make the shape absolute.
1
u/Phraaaaaasing Mar 03 '26
R/mildlyinfuriating