web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply 2 CSS to 2 HTML ...
Power Automate
Answered

Apply 2 CSS to 2 HTML tables in one email

(0) ShareShare
ReportReport
Posted on by 10

Hello,

I am trying to generate results from a DAX query on a PBI dataset, with the specificity to split the results in 2 tables : one for positive results, the other for negatives.

And for each, I have stored the results in 2 HTML tables, did 2 CSS that are exactly the same except that the last column containing my % should be red for the negatives table, and green for the positives.

Antoine_C_1-1706289806131.png

Red text for last column in neg table

 

Antoine_C_2-1706289819509.png

Green text for last column in pos table



Antoine_C_0-1706289771286.png

When I run it, I get this :

Antoine_C_3-1706289947342.png

Both tables have the last column green, meaning that in some way the CSS for the second table overrides the first one.

Are there any way to avoid/workaround this ?

Thanks a lot for the help !

Best regards

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at

    You need to add a CSS class to differentiate the tables.

    In table 1's HTML replace <table> with <table class="table1">

    and in its CSS replace table tbody ... with table.table1 tbody ...

    You can, although probably not necessary, do the same with table 2 and a different class name.

     

  • Antoine_C Profile Picture
    10 on at

    Thanks for the answer.

    The HTML table is not coded, it's a simple "Generate HTML table" action.

    Antoine_C_0-1706525759536.png


    How can I change the class of this table ?

    Or does that mean I have to code it to get the behaviour I want ?

    Regards

  • Verified answer
    Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at

    Just add  Compose actions and do the replacements.

    An example:

    Chriddle_0-1706527888569.png

    Compose:

    concat(
    	'<style>table.table1 tbody td:last-child{color:#FF2220}</style>',
    	replace(body('Create_HTML_table'), '<table>', '<table class="table1">')
    )

    Compose 2:

    concat(
    	'<style>table.table2 tbody td:last-child{color:#3CD274}</style>',
    	replace(body('Create_HTML_table_2'), '<table>', '<table class="table2">')
    )

     

  • Antoine_C Profile Picture
    10 on at

    Yes that works !

    Antoine_C_0-1706539076839.png



    Thanks a lot !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard