17.3k views
2 votes
How to add more than one background image in html

User TyrantWave
by
7.5k points

1 Answer

3 votes

Final answer:

To add multiple background images in HTML, use the CSS3 background-image property by listing the images separated by commas. You can also set the position and repetition for each image using background-position and background-repeat properties respectively.

Step-by-step explanation:

To add more than one background image in HTML, you can use CSS3 properties. This is achieved by specifying multiple images separated by commas within the background-image property.

Here's an example of the CSS code:

body { background-image: url('image1.jaypeegee'), url('image2.jaypeegee');
background-position: right bottom, left top;
background-repeat: no-repeat, repeat;}

This code adds two background images to the body of the HTML document. The first background image 'image1.jaypeegee' will be positioned at the right bottom, and it will not repeat. The second image 'image2.jaypeegee' will be positioned at the left top, and it will repeat.

User Webmasters
by
7.2k points