Last updated 13 days ago by Andrew Welchcss
The CSS background-image property allowed us to do some amazing things, but in most cases, it’s time to leave it behind.
Many of us have cut our teeth using the CSS background-image property to do a wide variety of things. To many, it’s like an old friend, but it’s one we should consider saying goodbye to.
The real problem isn’t the CSS background-image property itself. Rather it is that it’s been used in places where it really shouldn’t be, such as for the main CTA hero image or for UI images.
Used improperly, background-image can be an anti-pattern. Are there legit use cases for background-image? Of course.
However, there are some serious downsides to using the CSS background-image property, and more importantly, we have better ways to implement images in our browsers today.