Custom Module for Background Image?

Is there a standard for custom modules for background images? I have a custom module that works perfectly with one template and not another (with very little variation between the two) and I have no idea why it won’t work.

Here’s my code for my custom module:

<style>
.main-image {
 background: url('{{ widget.header_image.src }}');
 background-size: 100% auto;
 background-repeat:no-repeat;
 background-position: center top !important;
}
</style>

Then I’m calling that style in the group in which I want it to appear.

Is there something that is more standard or better?

Thanks for the help!

Lisa

One issue: widget**_data**.header_image.src not widget.header_image.src

That should fix it.

<style>
.main-image {
 background: url('{{ widget_data.header_image.src }}');
 background-size: 100% auto;
 background-repeat:no-repeat;
 background-position: center top !important;
}
</style>

Hmm.. that didn’t help and when I copy the snippet, data isn’t in there :disappointed_face:

I just don’t understand why this would work with one template and not another. It makes no sense to me.

I fixed this. Want to know how? I deleted the module and added it back.

Sometimes these hubspot templates are still buggy.

I have one question where you put this code? Can you tell me. Because i am new in hubspot.