How to add multiple backgrounds to an element in CSS

Overview

The background-image property can add multiple background images to an element. It allows us to append multiple image URLs with a comma (,) and stacks the images on top of each other.

Code

Explanation

HTML

  • Lines 4-5: These lines just set up the basic layout and add some text for our Html page.

  • Lines 7-10: These lines create a div (CSS element), test.

CSS

  • Lines 1-6: These lines set the layout for the test div. The styling sets the two images as the background and defines their positions.

Free Resources