Re: Is there a way to set background image as an Element and not a Variable?

Anonymous
Not applicable

Is there a way to set background image as an Element and not a Variable?

I am editing a landing page for a client and they are asking to be able to update background images the same way they update the other images - as dynamic content, able to pick from an admin panel of images.

6 REPLIES 6
Justin_Cooperm2
Level 10

Re: Is there a way to set background image as an Element and not a Variable?

Graham Lutz​ - not that will work with all email clients. It's actually quite tricky to make it work correctly. You'll see that there is some conditional code for various versions of Outlook. There are ways to do it as an Image element in a Landing Page, however.

Justin

Anonymous
Not applicable

Re: Is there a way to set background image as an Element and not a Variable?

This is going to be a landing page, not an email template. Do you know how to do it in a Landing Page?

Grégoire_Miche2
Level 10

Re: Is there a way to set background image as an Element and not a Variable?

Hi Graham,

Image elements generate <img> tags. while a background image is anything BUT and imag element with a backgound css property.

So the only way to do this with an image element, would be to use some JS to capture the image and use it at a background somewhere else.

-Greg

Anonymous
Not applicable

Re: Is there a way to set background image as an Element and not a Variable?

Thanks, Greg

Just to be clear, are you saying there is no way to set a background image from an admin panel, similar to how img tag images are set? 

Grégoire_Miche2
Level 10

Re: Is there a way to set background image as an Element and not a Variable?

Hi Graham,

Yes there is a solution

There is no image variable for the moment, so you can use a string variable in which you enter the image URL.

Then, in your LP template code, you use that variable in the CSS code:

background-image: url(§{YourURLVariable})

-Greg

Justin_Cooperm2
Level 10

Re: Is there a way to set background image as an Element and not a Variable?