<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Custom Module for emails in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/959719#M38661</link>
    <description>&lt;P&gt;Hi guys! I am trying to create a custom module for an email template. The section has two columns and I need both columns to have different background colors. As far as I know, HS editor allows me to modify the entire section background-color, but not the one in each column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just trying to find out if there are some materials regarding this topic to help me get this done. The image below is what I currently have, and the other one is what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your comments on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scalabria_0-1712957981931.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115220i5CF0F6CB4270518B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scalabria_0-1712957981931.png" alt="scalabria_0-1712957981931.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scalabria_1-1712958084627.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115221iB5694F4F6A540317/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scalabria_1-1712958084627.png" alt="scalabria_1-1712958084627.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2024 21:41:44 GMT</pubDate>
    <dc:creator>scalabria</dc:creator>
    <dc:date>2024-04-12T21:41:44Z</dc:date>
    <item>
      <title>Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/959719#M38661</link>
      <description>&lt;P&gt;Hi guys! I am trying to create a custom module for an email template. The section has two columns and I need both columns to have different background colors. As far as I know, HS editor allows me to modify the entire section background-color, but not the one in each column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just trying to find out if there are some materials regarding this topic to help me get this done. The image below is what I currently have, and the other one is what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your comments on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scalabria_0-1712957981931.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115220i5CF0F6CB4270518B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scalabria_0-1712957981931.png" alt="scalabria_0-1712957981931.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scalabria_1-1712958084627.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115221iB5694F4F6A540317/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scalabria_1-1712958084627.png" alt="scalabria_1-1712958084627.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 21:41:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/959719#M38661</guid>
      <dc:creator>scalabria</dc:creator>
      <dc:date>2024-04-12T21:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960430#M38667</link>
      <description>&lt;P&gt;Hi scalabria,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As you may have noticed, it's possible to change the background of the entire section in the email editor.&lt;/P&gt;&lt;P&gt;What you could do is create a completely new custom module with two color picker fields. Then, you can apply the background using inline style, for example: style="background-color: {{ module.bg_first_col.color }}".&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Since you've already created the section in the email editor, I would suggest copying the entire HTML code of the section using the developer tool and pasting it into the new module. This way, you can save some time.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Gracjan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 10:54:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960430#M38667</guid>
      <dc:creator>Gracjan</dc:creator>
      <dc:date>2024-04-15T10:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960537#M38668</link>
      <description>&lt;P&gt;Hi Gracjan!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response. Yes! I did it already, somehow in any landing page that section works fine, however, in any of my emails, that section does not reflect the background color I set at the custom module.&lt;BR /&gt;&lt;BR /&gt;Not sure why. Emaili template may have something set that override that code?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 14:34:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960537#M38668</guid>
      <dc:creator>scalabria</dc:creator>
      <dc:date>2024-04-15T14:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960546#M38669</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/404959"&gt;@scalabria&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;would you share the module code so we can have a look into it?&lt;BR /&gt;&lt;BR /&gt;I would also recommend you to create separate module for email only.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Gracjan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 14:40:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960546#M38669</guid>
      <dc:creator>Gracjan</dc:creator>
      <dc:date>2024-04-15T14:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960610#M38670</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/580011"&gt;@Gracjan&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sure, below is the entire code. I added some images showing the preview from this code in HS and how it looks when I use it on the email section.&lt;/P&gt;&lt;P&gt;—&lt;/P&gt;&lt;P&gt;&amp;lt;div class="main-container row"&amp;gt;&lt;BR /&gt;&amp;lt;div class="col-lg-6"&amp;gt;&lt;BR /&gt;{% if module.image_left.src %}&lt;BR /&gt;{% set sizeAttrs = 'width="{{ module.image_left.width|escape_attr }}" height="{{ module.image_left.height|escape_attr }}"' %}&lt;BR /&gt;{% if module.image_left.size_type == 'auto' %}&lt;BR /&gt;{% set sizeAttrs = 'width="{{ module.image_left.width|escape_attr }}" height="{{ module.image_left.height|escape_attr }}" style="max-width: 100%; height: auto;"' %}&lt;BR /&gt;{% elif module.image_left.size_type == 'auto_custom_max' %}&lt;BR /&gt;{% set sizeAttrs = 'width="{{ module.image_left.max_width|escape_attr }}" height="{{ module.image_left.max_height|escape_attr }}" style="max-width: 100%; height: auto;"' %}&lt;BR /&gt;{% endif %}&lt;BR /&gt;{% set loadingAttr = module.image_left.loading != 'disabled' ? 'loading="{{ module.image_left.loading|escape_attr }}"' : '' %}&lt;BR /&gt;&amp;lt;img src="{{ module.image_left.src|escape_url }}" alt="{{ module.image_left.alt|escape_attr }}" {{ loadingAttr }} {{ sizeAttrs }}&amp;gt;&lt;BR /&gt;{% endif %}&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;div class="col-lg-7"&amp;gt;&lt;BR /&gt;{% if module.image_right.src %}&lt;BR /&gt;{% set sizeAttrs = 'width="{{ module.image_right.width|escape_attr }}" height="{{ module.image_right.height|escape_attr }}"' %}&lt;BR /&gt;{% if module.image_right.size_type == 'auto' %}&lt;BR /&gt;{% set sizeAttrs = 'width="{{ module.image_right.width|escape_attr }}" height="{{ module.image_right.height|escape_attr }}" style="max-width: 100%; height: auto;"' %}&lt;BR /&gt;{% elif module.image_right.size_type == 'auto_custom_max' %}&lt;BR /&gt;{% set sizeAttrs = 'width="{{ module.image_right.max_width|escape_attr }}" height="{{ module.image_right.max_height|escape_attr }}" style="max-width: 100%; height: auto;"' %}&lt;BR /&gt;{% endif %}&lt;BR /&gt;{% set loadingAttr = module.image_right.loading != 'disabled' ? 'loading="{{ module.image_right.loading|escape_attr }}"' : '' %}&lt;BR /&gt;&amp;lt;img src="{{ module.image_right.src|escape_url }}" alt="{{ module.image_right.alt|escape_attr }}" {{ loadingAttr }} {{ sizeAttrs }}&amp;gt;&lt;BR /&gt;{% endif %}&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;{% require_css %}&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;{% scope_css %}&lt;BR /&gt;.main-container {&lt;BR /&gt;width: 100%;&lt;BR /&gt;display: flex;&lt;BR /&gt;background-color: transparent!important;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;.col-lg-7 {&lt;BR /&gt;width: 100%;&lt;BR /&gt;display: flex;&lt;BR /&gt;background-color: {{ module.bg_color_right.color }};&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;{% end_scope_css %}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;{% end_require_css %}&lt;/P&gt;&lt;P&gt;—&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the 1st screenshot you´ll see the second column with a different color.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scalabria_0-1713197047560.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115299i35B8C4B49DF6ABEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scalabria_0-1713197047560.png" alt="scalabria_0-1713197047560.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the second one, how it looks when I try to use it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scalabria_1-1713197079010.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/115300iC218696F849C6FCB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scalabria_1-1713197079010.png" alt="scalabria_1-1713197079010.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 16:04:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960610#M38670</guid>
      <dc:creator>scalabria</dc:creator>
      <dc:date>2024-04-15T16:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960614#M38671</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/404959"&gt;@scalabria&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for sharing your custom code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, you cannot reuse this module in email templates as is. I assume you are also using Bootstrap or another framework for the grid system. While this may function properly in your theme and on your CMS pages, it won't translate well to email templates.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Email templates have significant limitations when it comes to styling. Drag-and-drop email modules do not support 'require_css' or external CSS (and JavaScript) files. Instead, you must utilize inline styles (e.g., 'style=""').&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Additionally, in email templates, it's advisable to use tables to position items next to each other, similar to using 'col' classes.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I suggest rebuilding this section in the drag-and-drop email editor and then inspecting the code using development tools to copy it into your new module. You should also create this module for emails only.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards, Gracjan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 16:15:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960614#M38671</guid>
      <dc:creator>Gracjan</dc:creator>
      <dc:date>2024-04-15T16:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Module for emails</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960638#M38672</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/580011"&gt;@Gracjan&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will do as you advice. I appreciate your time helping me through.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;Seb&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 17:17:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Custom-Module-for-emails/m-p/960638#M38672</guid>
      <dc:creator>scalabria</dc:creator>
      <dc:date>2024-04-15T17:17:38Z</dc:date>
    </item>
  </channel>
</rss>

