<?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: Using Field to specifiy CSS attributes for Pseudo-classes in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461865#M24100</link>
    <description>&lt;P&gt;Thank you for the solution!&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jul 2021 14:07:17 GMT</pubDate>
    <dc:creator>HaNguyen</dc:creator>
    <dc:date>2021-07-19T14:07:17Z</dc:date>
    <item>
      <title>Using Field to specifiy CSS attributes for Pseudo-classes</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461665#M24093</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Hubspot Community, as the title suggests, I would like to ask about how to pass a Field Value into CSS property only "on hover" of an element inside a custom Module. I have tried creating the Field "color_field" containing the values, using Hubl markup to create a variable such as {% set TextHoverColor = '{{module.color_field.color}}' %} and assigning this variable as value of a CSS property for the said element. The Hubl Markup I have written directly inside the module's Hubl+HTML area, while the assigning is done in a seperate Hubl+CSS file that is then linked to the module. But the desired effect is unfortunately still not achieved. Could you give me a suggestion on how this can be done ? Thank you in advance.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 08:28:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461665#M24093</guid>
      <dc:creator>HaNguyen</dc:creator>
      <dc:date>2021-07-19T08:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Field to specifiy CSS attributes for Pseudo-classes</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461831#M24098</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/212807"&gt;@HaNguyen&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you check the documentation for the &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/modules/files" target="_blank" rel="noopener"&gt;modules&lt;/A&gt;. You can use the '&lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/modules/files#require-css-block" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;require_css&lt;/SPAN&gt;&lt;/A&gt;' for better handeling your css. Your css will need to be added to the 'Hubl+HTML' section.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the &lt;A href="https://developers.hubspot.com/en/docs/cms/building-blocks/module-theme-fields#color" target="_blank" rel="noopener"&gt;color field&lt;/A&gt;, it will return multiple values.&lt;/P&gt;
&lt;LI-CODE lang="css"&gt;.color{
  color: {{ module.color_field.color }};
  opacity: {{ module.color_field.opacity }};
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to use the color for a background of just want to use the color and opacity, you can combine it like this.&lt;/P&gt;
&lt;LI-CODE lang="css"&gt;{% set color = module.cta.overlay.color %}
{% set opacity = module.cta.overlay.opacity %}
{% set color_rgba = color|convert_rgb ~','~ opacity/100 %}

.color{
  color: rgba( {{ color_rgba }} );
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So for your example, just change your css and don't forget to use 'require_css' for better handeling your css.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set color = module.cta.overlay.color %}
{% set opacity = module.cta.overlay.opacity %}
{% set color_rgba = color|convert_rgb ~','~ opacity/100 %}

{% require_css %}
&amp;lt;style type="text/css"&amp;gt;
  .color:hover{
    color: rgba( {{ color_rgba }} );
  }
&amp;lt;/style&amp;gt;
{% end_require_css %}

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are going to use this module multiple times on a page. Just add a unique 'class' or 'id' to your elements like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% require_css %}
&amp;lt;style type="text/css"&amp;gt;
  #{{ name }}:hover{
    color: #00000;
  }
&amp;lt;/style&amp;gt;
{% end_require_css %}

&amp;lt;div id="{{ name }}"&amp;gt;
  Sample text
&amp;lt;/div&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;Did this answered your question? If so, please mark as resolved. If not, please let me know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 13:29:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461831#M24098</guid>
      <dc:creator>Indra</dc:creator>
      <dc:date>2021-07-19T13:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using Field to specifiy CSS attributes for Pseudo-classes</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461865#M24100</link>
      <description>&lt;P&gt;Thank you for the solution!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:07:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-Field-to-specifiy-CSS-attributes-for-Pseudo-classes/m-p/461865#M24100</guid>
      <dc:creator>HaNguyen</dc:creator>
      <dc:date>2021-07-19T14:07:17Z</dc:date>
    </item>
  </channel>
</rss>

