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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Format html text color...
Power Automate
Answered

Format html text color based on value

(0) ShareShare
ReportReport
Posted on by 78

Hi All,

 

i'm using the below in compose to create a html table. I want to be able to format the color of the font depending on the value. i.e. Yes = Green, No = Red, Maybe = Amber.

 

I'm not familiar with html/ CSS and have used an online formatter to create the code, so not sure where/ how to edit it. Can someone help on where to put whats needed please?

 

<style>

table.BC {

border: 1px solid #1C6EA4;

background-color: #EEF3FF;

width: 100%;

text-align: left;

}

table.BC td, table.BC th {

border: 1px solid #AAAAAA;

padding: 0px 2px;

}

table.BC tbody td {

font-size: 15px;

color: #05004F;

}

table.BC thead {

background: #0C2CA4;

border-bottom: 2px solid #000000;

}

table.BC thead th {

font-size: 20px;

font-weight: bold;

color: #000000;

text-align: center;

}

table.BC tfoot td {

font-size: 14px;

}

table.BC tfoot .links {

text-align: right;

}

table.BC tfoot .links a{

display: inline-block;

background: #1C6EA4;

color: #FFFFFF;

padding: 2px 8px;

border-radius: 5px;

}

</style>

Categories:
I have the same question (0)
  • Geeks_D Profile Picture
    1,169 on at

    Hello 
    You cannot use if statement in HTML style tags 
    This can be done with CSS in your tag

    See this tutorial for more guide 
    https://www.geeksforgeeks.org/if-else-condition-in-css/

     

  • SimpleUser Profile Picture
    78 on at

    Thank you, i'm not sure where to start with this. The full code is below and the cells in red are the ones i need the condition against.

     

    <style>

    table.BC {

    border: 1px solid #1C6EA4;

    background-color: #EEF3FF;

    width: 100%;

    text-align: left;

    }

    table.BC td, table.BC th {

    border: 1px solid #AAAAAA;

    padding: 0px 2px;

    }

    table.BC tbody td {

    font-size: 15px;

    color: #05004F;

    }

    table.BC thead {

    background: #0C2CA4;

    border-bottom: 2px solid #000000;

    }

    table.BC thead th {

    font-size: 20px;

    font-weight: bold;

    color: #000000;

    text-align: center;

    }

    table.BC tfoot td {

    font-size: 14px;

    }

    table.BC tfoot .links {

    text-align: right;

    }

    table.BC tfoot .links a{

    display: inline-block;

    background: #1C6EA4;

    color: #FFFFFF;

    padding: 2px 8px;

    border-radius: 5px;

    }

    </style>

    <table class="BC">

    <thead>

    <tr>

    <th>Question</th>

    <th>Response</th>

    </tr>

    </thead>

    <tbody>

    <tr>

    <td>Advisor Name:</td>

    <td></td>

    </tr>

    <tr>

    <td>Submitted by:</td>

    <td></td>

    </tr>

    <tr>

    <td>Performance period:</td>

    <td></td>

    </tr>

    <tr>

    <td>Knowledge and expertise</td>

    <td></td>

    </tr>

    <tr>

    <td>Level of professionalism displayed:</td>

    <td></td>

    </tr>

    <tr>

    <td>Can-do, supportive attitude displayed:</td>

    <td></td>

    </tr>

    <tr>

    <td>Ability to understand your needs:</td>

    <td></td>

    </tr>

    <tr>

    <td>Ability to provide you with valuable advice:</td>

    <td></td>

    </tr>

    <tr>

    <td>Ability to integrate within your organisation:</td>

    <td></td>

    </tr>

    <tr>

    <td>Overall quality of the services provided:</td>

    <td></td>

    </tr>

    <tr>

    <td>Do you consider the services provided value for money?</td>

    <td></td>

    </tr>

    <tr>

    <td>Please name an improvement you would like to see in the services provided:</td>

    <td></td>

    </tr>

    <tr>

    <td>Any other comments:</td>

    <td></td>

    </tr>

    </tbody>

    </table>

  • Verified answer
    SimpleUser Profile Picture
    78 on at

    I worked out you can put an if function within the html code to help provide a style dependent on value.

     

    The if function simply looks at the value then returns the relevant color code. Works perfectly.

     

    SimpleUser_0-1702471332309.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard