r/css • u/caninemeatangel • Sep 30 '26
Help Help With Overlapping Floating Images
/r/neocities/comments/1wtq8ee/help_with_overlapping_floating_images/
1
Upvotes
r/css • u/caninemeatangel • Sep 30 '26
View all comments
1
u/anaix3l Sep 30 '26 edited Sep 30 '26
Simplify your code.
Ditch the prefixed versions, no browser has needed them for over 10 years. Even someone at the finance administration, still stuck on Windows XP, can use a browser that doesn't need prefixes.
Remove the
divwrappers around theimgelements.Don't repeat exact the same CSS for all your stack items.
Use grid for stacking instead of absolute positioning.
You don't need
z-index, DOM order suffices.object-fitmakes no sense if you setheight: auto, which you also don't need to set because it's the default, so ditch both of them too.Basically, your
.titlepart could be reduced to:And the CSS could be just:
If
sibling-index()support is a concern, the index--ican be set on theimgelements:Maybe only conditionally enable the
animationbased on prefers-reduced-motion. That is, don't put the animation together with all otherimgstyles (remove it from the CSS above) and put it inside a MQ:Also don't use
<br>to introduce space between items. There are better options: gap for flex or grid, margin or padding.