Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Background Images using Sass / Compass

The following generates a base64 inline-image using sass/compass:

background-image:inline-image("paper.jpg", 'image/jpg');

Is there a way to do multiple background images, or do I have to precompress them myself to do it?

Thanks.

like image 632
Matrym Avatar asked May 01 '11 05:05

Matrym


1 Answers

The inline-image function just outputs the url() string, so you can use multiple by doing this:

background: inline-image("front-image.jpg", 'image/jpg') no-repeat, inline-image("back-image.jpg", 'image/jpg') repeat-x

And you'll get the following css:

background: url('data:"image/jpg";base64,FRONTIMAGEDATAHERE') no-repeat, url('data:"image/jpg";base64,BACKIMAGEDATAHERE') repeat-x;

I added "no-repeat" and "repeat-x" otherwise the front-image will repeat and cover the back-image.

like image 60
Beau Smith Avatar answered Oct 01 '22 13:10

Beau Smith