# module css does not working

**URL:** <https://community.hubspot.com/t/module-css-does-not-working/23976>\
**Category:** CMS Development\
**Created:** [August 10, 2020, 9:17am UTC](https://community.hubspot.com/t/module-css-does-not-working/23976 "2020-08-10T09:17:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdur](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abdur/32/99678_2.png) [@abdur](https://community.hubspot.com/u/abdur)\
**Post date:** [August 10, 2020, 9:17am UTC](https://community.hubspot.com/t/module-css-does-not-working/23976/1 "2020-08-10T09:17:51Z")

</div>

can anyone tell me what is wrong in this code.

i am trying to add a simple css on a repeatable group **module. css is when I hover on a image the text changes opacity. but the problem is no matter what I do the opacity changing css wont work if I select a img tag or the class of the image tag. but if I change the tag to anything else like ‘body , h3’ or other class (except the image class or tag) the css works perfectly.**

\<div class=“Leaders\_module”\>  
\<div class=“Leaders\_module\_container col\_2”\>  
{% for item in module.leaders\_module\_group\_fields %}  
\<div class=“img\_box”\> //image or any image class  
\<img src=“{{ item.leaders\_module\_image.src }}” class=“leader\_image” alt=“{{ item.leaders\_module\_image.alt }}” {{ sizeAttrs }}\>  
\</div\>  
\<div class=“Leaders\_module\_text\_container”\>  
\<span class=“Leaders\_module\_text”\>  
\<h3 class=“leader\_name”\>  
{% inline\_text field=“leaders\_module\_name” value=“{{ item.leaders\_module\_name }}” %}  
\</h3\>  
\<h4 class=“leader\_title”\>  
{% inline\_text field=“leader\_title” value=“{{ item.leader\_title }}” %}  
\</h4\>  
\</span\>  
\</div\>  
{% endfor %}  
\</div\>  
\</div\>

css

.Leaders\_module\_container {

}  
.leader\_image {  
position:relative;  
display:inline-block;  
}  
img {  
transition: .5s ease-in-out all;  
z-index:1  
}  
.img\_box{  
z-index:2;}  
.Leaders\_module\_text {  
color:red;  
font-weight:600;  
font-size:1.25em;  
position: absolute;  
top:0;  
left:0;  
opacity:1;  
margin: auto;  
z-index:100;  
}  
.Leaders\_module\_text\_container{  
width 100%;  
}  
.Leaders\_module\_text {  
text-align:center;  
transition: .5s ease-in-out all;  
}

.leader\_image:hover{

}  
// this css does not work with image  
.img\_box:hover .Leaders\_module\_text{  
opacity:0;  
}

---

<div class="post-metadata">

**Author:** ![Jake\_Lett](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jake_lett/32/45178_2.png) [@Jake\_Lett](https://community.hubspot.com/u/Jake_Lett)\
**Post date:** [August 10, 2020, 1:14pm UTC](https://community.hubspot.com/t/module-css-does-not-working/23976/2 "2020-08-10T13:14:49Z")

</div>

Here is something you could try in order to change the opacity on hover.

**Restructure HTML wrapper around the image and text. So when you hover over the wrapper you can change the opacity.**

\<div class=“Leaders\_module”\>  
{% for item in module.leaders\_module\_group\_fields %}  
\<div class=“Leaders\_module\_container col\_2”\>  
\<div class=“img\_box”\> //image or any image class  
\<img src=“{{ item.leaders\_module\_image.src }}” class=“leader\_image” alt=“{{ item.leaders\_module\_image.alt }}” {{ sizeAttrs }}\>  
\</div\>  
\<div class=“Leaders\_module\_text\_container”\>  
\<span class=“Leaders\_module\_text”\>  
\<h3 class=“leader\_name”\>  
{% inline\_text field=“leaders\_module\_name” value=“{{ item.leaders\_module\_name }}” %}  
\</h3\>  
\<h4 class=“leader\_title”\>  
{% inline\_text field=“leader\_title” value=“{{ item.leader\_title }}” %}  
\</h4\>  
\</span\>  
\</div\>  
\</div\>  
{% endfor %}  
\</div\>

**Add the hover effect to the repeated item wrapper**

.Leaders\_module\_container:hover .Leaders\_module\_text{  
opacity:0;  
}

* * *

**Jacob Lett**

[Freelance HubSpot CMS Developer & Web Designer](https://bootstrapcreative.com/hubspot-designer/?utm_source=HubSpotCommunity&utm_term=tagline)

* * *

[  
  ![28844i368E9AAC739341A8.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/0/0fa6bcd420e080a29fc75d42359cf2879b6e162d.png)  
 ](https://bootstrapcreative.com/hubspot-designer/?utm_source=HubSpotCommunity&utm_term=logo)

Located in Michigan, USA

[**Get a free estimate now ›**](https://bootstrapcreative.com/contact-us/?utm_source=HubSpotCommunity&utm_term=free%20estimate)

* * *

---

<div class="post-metadata">

**Author:** ![abdur](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abdur/32/99678_2.png) [@abdur](https://community.hubspot.com/u/abdur)\
**Post date:** [August 10, 2020, 2:31pm UTC](https://community.hubspot.com/t/module-css-does-not-working/23976/3 "2020-08-10T14:31:08Z")

</div>

Thank u very much **Jacob** that helped a lot\*\*. it was really frustrating.\*\*
