<?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 Re: Trouble using Spacing field to give to your own module in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978702#M39133</link>
    <description>&lt;P&gt;I see, thank you very much.&lt;BR /&gt;However, this is only relevant for the top margin, and in fact the style panel allows both 4-cornered margins and padding to be selected, right? I don't think it is necessarily only about the margin tops.&lt;BR /&gt;In such a case, how can I specify the selector so that if I have multiple unique modules on the same page, they can each have different margins and paddings and not overwrite each other?&lt;BR /&gt;Is there anything in the boilerplate, for example, that replicates this? I would like to see a sample if you have one.&lt;/P&gt;</description>
    <pubDate>Sat, 18 May 2024 23:25:19 GMT</pubDate>
    <dc:creator>TMisuna</dc:creator>
    <dc:date>2024-05-18T23:25:19Z</dc:date>
    <item>
      <title>Trouble using Spacing field to give to your own module</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978652#M39130</link>
      <description>&lt;P&gt;I have created my own heading module using the following code.&lt;BR /&gt;However, the following problems occurred&lt;/P&gt;&lt;P&gt;1) Placing this heading module in multiple pages as drag-and-drop content.&lt;BR /&gt;(2) Margin is given to each heading, margin-top:40px for the first, margin-top:60px for the second, and margin-top:80px for the third&lt;BR /&gt;3) Since the margin space field is used for the selector named .c-general-heading, it is overwritten as shown below, and it is not possible to give different margin-tops for each module.&lt;BR /&gt;How can I give a dynamic spacing number in the spacing field to a selector, is it down to some module-specific id or something?&lt;BR /&gt;Where can I look to solve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;h2 class="c-general-heading"&amp;gt;
  &amp;lt;span class="c-general-heading__english"&amp;gt;{{ module.general_heading_english }}&amp;lt;/span&amp;gt;
  &amp;lt;span class="c-general-heading__japanese"&amp;gt;{{ module.general_heading_japanese }}&amp;lt;/span&amp;gt;
&amp;lt;/h2&amp;gt;

{% require_css %}
&amp;lt;style&amp;gt;
  .c-general-heading {
    margin-top: {{ module.style.spacing_field.margin.top.value }}{{ module.style.spacing_field.margin.top.units }};
    margin-bottom: {{ module.style.spacing_field.margin.bottom.value }}{{ module.style.spacing_field.margin.bottom.units }};
    padding-right: {{ module.style.spacing_field.padding.right.value }}{{ module.style.spacing_field.padding.right.units }};
    padding-bottom: {{ module.style.spacing_field.padding.bottom.value }}{{ module.style.spacing_field.padding.bottom.units }};
    padding-top: {{ module.style.spacing_field.padding.top.value }}{{ module.style.spacing_field.padding.top.units }};
    padding-left: {{ module.style.spacing_field.padding.left.value }}{{ module.style.spacing_field.padding.left.units }};;
  }
&amp;lt;/style&amp;gt;
{% end_require_css %}&lt;/LI-CODE&gt;&lt;P&gt;The style reflected on the page. If you have multiple modules and set them in the style panel each time, they will be overwritten.&lt;/P&gt;&lt;LI-CODE lang="css"&gt;&amp;lt;style&amp;gt;
  .c-general-heading {
    margin-top: 40px;
  }
&amp;lt;/style&amp;gt;

&amp;lt;style&amp;gt;
  .c-general-heading {
    margin-top: 60px;
  }
&amp;lt;/style&amp;gt;

&amp;lt;style&amp;gt;
  .c-general-heading {
    margin-top: 80px;
  }
&amp;lt;/style&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 13:10:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978652#M39130</guid>
      <dc:creator>TMisuna</dc:creator>
      <dc:date>2024-05-18T13:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using Spacing field to give to your own module</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978681#M39132</link>
      <description>&lt;P&gt;You have 1 class that is being given 3 different margins.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each time the Module is used, it needs to have a unique ID if you want it to have 3 unique margins.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a quick solution, you can give the h2 an ID, that you select when using the module on a page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;h2 class="c-general-heading" id="{{ module.margin_top }}"&amp;gt;
  &amp;lt;span class="c-general-heading__english"&amp;gt;{{ module.general_heading_english }}&amp;lt;/span&amp;gt;
  &amp;lt;span class="c-general-heading__japanese"&amp;gt;{{ module.general_heading_japanese }}&amp;lt;/span&amp;gt;
&amp;lt;/h2&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add a logic &amp;gt; choice module called "margin_top" that spits out c-general-margin-40,&amp;nbsp;c-general-margin-60 or c-general-margin-80 as an ID depending on your choice, then&amp;nbsp;you can have styling for 3 different ID's&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;style&amp;gt;
  #c-general-margin-40 {
    margin-top: 40px;
  }

  #c-general-margin-60 {
    margin-top: 60px;
  }
  #c-general-margin-60 {
    margin-top: 80px;
  }
&amp;lt;/style&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 18:09:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978681#M39132</guid>
      <dc:creator>pm8rsh88</dc:creator>
      <dc:date>2024-05-18T18:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using Spacing field to give to your own module</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978702#M39133</link>
      <description>&lt;P&gt;I see, thank you very much.&lt;BR /&gt;However, this is only relevant for the top margin, and in fact the style panel allows both 4-cornered margins and padding to be selected, right? I don't think it is necessarily only about the margin tops.&lt;BR /&gt;In such a case, how can I specify the selector so that if I have multiple unique modules on the same page, they can each have different margins and paddings and not overwrite each other?&lt;BR /&gt;Is there anything in the boilerplate, for example, that replicates this? I would like to see a sample if you have one.&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 23:25:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978702#M39133</guid>
      <dc:creator>TMisuna</dc:creator>
      <dc:date>2024-05-18T23:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using Spacing field to give to your own module</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978713#M39134</link>
      <description>&lt;P&gt;% scope_css %} may be a solution.&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 01:35:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978713#M39134</guid>
      <dc:creator>TMisuna</dc:creator>
      <dc:date>2024-05-19T01:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using Spacing field to give to your own module</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978754#M39135</link>
      <description>&lt;P&gt;An alternative solution, if you want to be able to control the Margin and Padding from the front end, rather than manually editing the CSS file through the design manager.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could create a text module called header_id. Then you switch the class over to an ID, then modify the code slightly as per below. Now, every time you use the module, make sure to give header_id either a unique id or use one already used on the page to use the same padding/margin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;h2 id="c-general-heading-{{ module.header_id }}"&amp;gt;
  &amp;lt;span class="c-general-heading__english"&amp;gt;{{ module.general_heading_english }}&amp;lt;/span&amp;gt;
  &amp;lt;span class="c-general-heading__japanese"&amp;gt;{{ module.general_heading_japanese }}&amp;lt;/span&amp;gt;
&amp;lt;/h2&amp;gt;

{% require_css %}
&amp;lt;style&amp;gt;
  #c-general-heading-{{ module.header_id }} {
    margin-top: {{ module.style.spacing_field.margin.top.value }}{{ module.style.spacing_field.margin.top.units }};
    margin-bottom: {{ module.style.spacing_field.margin.bottom.value }}{{ module.style.spacing_field.margin.bottom.units }};
    padding-right: {{ module.style.spacing_field.padding.right.value }}{{ module.style.spacing_field.padding.right.units }};
    padding-bottom: {{ module.style.spacing_field.padding.bottom.value }}{{ module.style.spacing_field.padding.bottom.units }};
    padding-top: {{ module.style.spacing_field.padding.top.value }}{{ module.style.spacing_field.padding.top.units }};
    padding-left: {{ module.style.spacing_field.padding.left.value }}{{ module.style.spacing_field.padding.left.units }};;
  }
&amp;lt;/style&amp;gt;
{% end_require_css %}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 10:46:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trouble-using-Spacing-field-to-give-to-your-own-module/m-p/978754#M39135</guid>
      <dc:creator>pm8rsh88</dc:creator>
      <dc:date>2024-05-19T10:46:28Z</dc:date>
    </item>
  </channel>
</rss>

