cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LazyLazy
Frequent Visitor

Add Hover css in HtmlText on PowerApps

How can I add Hover css in HtmlText like 

.myDIV:hover {
      display: block;
      color: red;
}
to

Set(CssHover,{  myDIV: "display: block;
                                               color: red;
"
}

                                 }

)

then i call this variable by <div style='"& CssHover.myDIV &"' ></div>

I can pass css to PowerApps variable by Set() but I can not pass ':hover' to it.

 

@Solved: Re: It is possible to declare css in powerapps? - Power Platform Community (microsoft.com)

 

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @LazyLazy 

Unfortunately, it is not possible to apply a hover style to a div in a HTMLText control.

:hover is a pseudo-selector. It only has meaning with a style sheet, and there isn't an inline-style equivalent.

Power Apps does not support external style sheets and for this reason, it isn't possible to apply a hover style.

This Stack Overflow post provides some more discussion on pseudo selectors.

https://stackoverflow.com/questions/14141374/using-css-before-and-after-pseudo-elements-with-inline-...

 

View solution in original post

2 REPLIES 2
v-jefferni
Community Support
Community Support

Hi @LazyLazy ,

 

Could you please share more details about what was the situation of "can not pass ':hover' to it"?

 

I made a test with your css code on my end, which which worked fine:

118.png

Have you missed quotations marks in HTMLText Box?

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

timl
Super User
Super User

Hi @LazyLazy 

Unfortunately, it is not possible to apply a hover style to a div in a HTMLText control.

:hover is a pseudo-selector. It only has meaning with a style sheet, and there isn't an inline-style equivalent.

Power Apps does not support external style sheets and for this reason, it isn't possible to apply a hover style.

This Stack Overflow post provides some more discussion on pseudo selectors.

https://stackoverflow.com/questions/14141374/using-css-before-and-after-pseudo-elements-with-inline-...

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,014)