Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Foundations Backgrounds and Borders Advanced Backgrounds

HOw do I add multiple background images which are stacked ?

just look tea]mtreehouse.com you can see multiple imahges are stacked on each other.

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

In their simplest form, you can add multiple backgrounds by simply separating each background rule declaration with a comma.

background: url(), background: url();

this is not working.i want background images one below the other.

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

Hi Akhil,

Basically you can stack BG images by stacking them this way.

background: url(), url(), url();

Keep in mind that the arrangement of the images when stacked this way is like this:

background: url(image that is on top), url( image that will go in between), url( image will be behind the first two);

Keep in mind that they should be separated by a comma with a space following the comma. And another tip is when you want to use a fallback color in case that browser is set to turn off images, you should add the color value AT THE LAST SEGMENT of the stacked values not on the first segment. So it should look something like this:

background: url(), url(), url() #f5f5f5;

Hope this helps!