Background Image Property

Last updated: 2026-09-13

background-image Background Image Property

background-image sets one or more background images on an element, supporting url() paths and gradient functions. Multiple backgrounds are comma-separated, with earlier images layered on top. It is usually used together with background-size and background-position.

Category
Initial Valuenone
InheritedNo
Applies Toall
Animation Typediscrete
CSS VersionCSS1
StatusStandard

📝 Syntax

background-image: none | <image> | linear-gradient() | radial-gradient();

⚙️ Values

ValueTypeDescription
noneKeywordNo background image
<image>Typeurl() image or gradient
linear-gradient() | radial-gradient()FunctionLinear or radial gradient

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
background-image v1 v12 v1 v1 v1
Supported in all major browsers
Tip: You can combine a background image with a background color; the image renders above the color, and the color shows through the image's transparent areas.
Tip: Images generated by gradient functions (linear-gradient, radial-gradient) also count as background images.

❓ FAQ

QHow do I stack multiple background images?
ASeparate the images with commas, e.g. background-image: url(a.png), url(b.png), linear-gradient(...); — the first one is on top. Each layer can be controlled independently with background-size and background-position, using comma-separated values that correspond one-to-one with the layers.
QWhat happens when a background image fails to load?
AIf a background-color is also set, the color shows as a fallback when the image fails (wrong path, blocked, or unsupported format); otherwise the background renders transparent. Keep in mind background-image has no alt text — purely decorative background images must not carry critical information. Use <img> with a text alternative for meaningful content.
QWhat is the difference between background-image and the <img> tag?
Abackground-image is part of CSS presentation: it is not in the document flow, is not indexed by search engines, has no alt semantics, and can be cropped and positioned freely — fine for decorative backgrounds. <img> is HTML content: it has alt text, can be indexed and selected, and is meant for meaningful content. When loading fails, <img> falls back to its alt, while a background image simply disappears.
QHow do I write background gradients?
AGradients are background images. linear-gradient(135deg, #667eea, #764ba2) transitions along a 135-degree angle; radial-gradient(circle, #fff, #333) spreads outward from the center. Stack several layers for more complex effects, and keep a solid background-color as a fallback.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏