CMS Development

SH82
Miembro

How to change css pseudo propery in module

resolver

I have premade module where i need to change background gradient by content creator by  targeting .classname__image::after element. i able to change element from " .classname__image" element but cannt target any pseduo element.

 

how can i creat multiple gradient color and content creator just click checkbox and color change.

 

 

.classname__image {
  text-align: right;
}


.classname__image::after {
  background:linear-gradient(256.1deg,rgba(56,158,60,.76) 15.56%,rgba(38,91,55,.79) 78.17%);
}

 

 

0 Me gusta
1 Soluciones aceptada
Anton
Solución
Experto reconocido | Partner nivel Diamond
Experto reconocido | Partner nivel Diamond

How to change css pseudo propery in module

resolver

Hi @SH82

have you tried it like this

.classname__image:after { {# just one colon instead of two #}
  background:linear-gradient(256.1deg,rgba(56,158,60,.76) 15.56%,rgba(38,91,55,.79) 78.17%);
}

 

For the second question: Are we talking about custom modules?

If so you could

- create different classes for each gradient like

.gradient1{
{# code for the first gradient #}
}
.gradient2{
{# code for the second gradient #}
}
.gradient3{
{# code for the third gradient #}
}

in a/your CSS file

- create a select option in the custom module and set the class names as the select value

- finaly place the code in the desired <div> like

<div class="some-class {{module.gradient_selector}}">
...
</div>

 

 

best, 

Anton

Anton Bujanowski Signature

Ver la solución en mensaje original publicado

3 Respuestas 3
Anton
Solución
Experto reconocido | Partner nivel Diamond
Experto reconocido | Partner nivel Diamond

How to change css pseudo propery in module

resolver

Hi @SH82

have you tried it like this

.classname__image:after { {# just one colon instead of two #}
  background:linear-gradient(256.1deg,rgba(56,158,60,.76) 15.56%,rgba(38,91,55,.79) 78.17%);
}

 

For the second question: Are we talking about custom modules?

If so you could

- create different classes for each gradient like

.gradient1{
{# code for the first gradient #}
}
.gradient2{
{# code for the second gradient #}
}
.gradient3{
{# code for the third gradient #}
}

in a/your CSS file

- create a select option in the custom module and set the class names as the select value

- finaly place the code in the desired <div> like

<div class="some-class {{module.gradient_selector}}">
...
</div>

 

 

best, 

Anton

Anton Bujanowski Signature
Jaycee_Lewis
Administrador de la comunidad
Administrador de la comunidad

How to change css pseudo propery in module

resolver

Thanks for the in-depth reply and for the examples, @Anton  🙌 – Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

Jaycee_Lewis
Administrador de la comunidad
Administrador de la comunidad

How to change css pseudo propery in module

resolver

Hi, @SH82 thanks for the code snippet! Let's see if any of our smart cookies here in the community can assist. Hey, @Anton and @alyssamwilie do you have any ideas for @SH82?

 

Thank you very much 🧡  – Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Me gusta