October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Place Two Different Background Images in One Div with CSS

Use comma-separated CSS background layers to put one decorative image on the left and another in the center of the same div.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use one element with a comma-separated list of CSS background layers. Give each image its own position so one sits on the left and the other stays centered. This is the right approach when both images are decorative.

Put both decorative images on the same element

For two decorative pictures in a header, list both image URLs in a single background declaration:

As an Amazon Associate I earn from qualifying purchases.

#header {
  min-height: 150px;
  background:
    url("left.png") left center / auto no-repeat,
    url("title.png") center center / auto no-repeat,
    #000;
}

The first background layer is painted on top of the layers that follow it. Here, left.png is positioned at the left edge and vertically centered; title.png is centered in the header. The final color is the background color beneath the images.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the CSS in an external stylesheet as usual. Replace the example file names with paths that are correct relative to that stylesheet. The element also needs visible area: its content, padding, or a defined height must give the backgrounds somewhere to appear. The example uses min-height only as a starting point; choose dimensions and scaling for your own images and layout.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Why the second image replaces the first

A declaration such as background-image: url("first.png") specifies one image. If another single-image declaration later sets background-image, that declaration replaces the earlier value in the cascade. Neither image is added automatically.

To display both, put both URLs in one comma-separated list:

#header {
  background-image: url("left.png"), url("title.png");
  background-position: left center, center center;
  background-repeat: no-repeat, no-repeat;
}

The lists correspond by position: the first position and repeat value apply to the first image, and the second values apply to the second. When a background property has fewer comma-separated values than there are image layers, CSS repeats its values to cover the remaining layers. Listing each value explicitly makes the intended mapping easier to see.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use background images only for decoration

CSS backgrounds are appropriate when the pictures are ornamental and do not convey information that visitors need. Assistive technologies do not announce CSS background images.

If either image communicates content—such as a meaningful logo or a title—use an HTML <img> with an appropriate alt value instead. If the image is artwork for a site title, provide the title’s meaning as document text or an accessible text alternative. Where the design allows it, ordinary HTML text is often more useful than an image of text.

When separate HTML images are a better fit

Use separate image elements or wrapper elements when the pictures carry meaningful content, need independent layout boxes, or need to behave differently from background layers. This gives each image a semantic place in the document and lets you provide alternative text. It can also be preferable when the project must support older browsers that do not handle multiple backgrounds.

For purely decorative art that should sit behind or around header content, multiple background layers are more concise. Choose between the approaches based on meaning, layout needs, overlap, sizing, and the project’s minimum browser support.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Browser support and layout checks

A 2012 SitePoint forum reply warned that multiple backgrounds might not work in older browsers, including IE8 and below. That is a historical warning, not a current compatibility summary. MDN describes background-image as widely available and says the feature has been available across browsers since July 2015. If legacy browser support matters, check the exact browsers your project targets.

  • Confirm that each image path resolves from the external CSS file.
  • Give the header visible dimensions through its content, padding, or sizing.
  • Set background-size if an image needs scaling; there is no universally correct value for unknown image dimensions.
  • Check the result at the viewport widths your layout must support, including whether the images overlap or crowd other header content.

Sources

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.