Background Image Vs HTML Image? Which One Should I Use?
Use CSS background-image property for decorative images. This means the image
- gives no information at all; and
- makes your website more attractive only; and
- is just a background image.
Use the HTML image element (<img>) for meaningful images. This means the image
- needs alternative text; or
- must exist to give users information; or
- is not a stock image.
A bonus tip: optimize the file size of your image. Do not make your users download 10 Megabytes (MB) of an image when it can be reduced to 1 MB—or even less. Use Squoosh or run it locally.
Share your thoughtsThank you for reading this Background Image Vs HTML Image? Which One Should I Use?. You can subscribe to all my articles with the Articles RSS. If you have a positive or negative comment, please send me an email or contact me through one of my social media accounts.
Share with your network
Copy this link and send it to great people only.
https://vanzasetia.xyz/blog/background-image/
For you
The Basic Guide to Run Squoosh Locally
This guide helps you set up Squoosh on Windows 10—a proprietary operating system with lots of malicious functionalities—and remove Google Analytics.
By Vanza Setia
Introducing Smart Website
I am going to publish a course so that personal websites become better than ever.
By Vanza Setia