Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 90e0JqSpXtI1IXM3S9tZO1
Power Automate - Building Flows
Answered

Formatting a specific table with CSS

Like (0) ShareShare
ReportReport
Posted on 31 Oct 2023 09:21:16 by 13

Hi everyone,

 

I'm having a bit of difficulty where I'm creating a HTML table in PA and utilising CSS to give it some styling, however the footer of the email also has a table which I do NOT want styled with the CSS.

 

I've tried using a replace compose operation similar to as follows with no luck, this is placed directly after the "Create HTML Table element of the flow.

 

replace(body('@{body('Create HTML Table')}'),'<table>','<table class=\"newtableID\">')

 

Any ideas?

  • SudeepGhatakNZ Profile Picture
    14,318 Most Valuable Professional on 01 Nov 2023 at 16:31:23
    Re: Formatting a specific table with CSS

    Sorry, I got busy. Great that you sorted it yourself.

     

     

  • Verified answer
    neilc28 Profile Picture
    13 on 01 Nov 2023 at 14:35:21
    Re: Formatting a specific table with CSS

    I've now resolved this by making the following changes to the flow: -

     

    Compose - Data Operation (Positioned directly below the action to create the HTML Table

     

     

    replace(body('HTML_Table_for_AC_Systems'),'<table>','<table class=CustomTable>')

     

     

    Then adjusted the Compose operation which held the CSS to reference the ID of the table (CustomTable) as per below.

     

     

    <style>
    .CustomTable {
     font-family: Arial, Helvetica, sans-serif;
     border: 1px solid #1C6EA4;
     background-color: #EEEEEE;
     width: 100%;
     text-align: left;
     border-collapse: collapse;
    }
    .CustomTable td, table.CustomTable th {
     border: 1px solid #AAAAAA;
     padding: 3px 2px;
    }
    .CustomTable tbody td {
     font-size: 13px;
    }
    .CustomTable tr:nth-child(even) {
     background: #D0E4F5;
    }
    .CustomTable thead {
     background: #1C6EA4;
     background: -moz-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
     background: -webkit-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
     background: linear-gradient(to bottom, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
     border-bottom: 2px solid #444444;
    }
    .CustomTable thead th {
     font-size: 15px;
     font-weight: bold;
     color: #FFFFFF;
     border-left: 2px solid #D0E4F5;
    }
    .CustomTable thead th:first-child {
     border-left: none;
    }
    
    .CustomTable tfoot {
     font-size: 14px;
     font-weight: bold;
     color: #FFFFFF;
     background: #D0E4F5;
     background: -moz-linear-gradient(top, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
     background: -webkit-linear-gradient(top, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
     background: linear-gradient(to bottom, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
     border-top: 2px solid #444444;
    }
    .CustomTable tfoot td {
     font-size: 14px;
    }
    .CustomTable tfoot .links {
     text-align: right;
    }
    .CustomTable tfoot .links a{
     display: inline-block;
     background: #1C6EA4;
     color: #FFFFFF;
     padding: 2px 8px;
     border-radius: 5px;
    }
    </style>

     

     

    Hope this helps anyone who has experienced the same issue

  • neilc28 Profile Picture
    13 on 31 Oct 2023 at 11:22:31
    Re: Formatting a specific table with CSS

     

     

     

    The email output now shows a table cell on the right side,The email output now shows a table cell on the right side,And also puts a table border around the signature areaAnd also puts a table border around the signature area

  • neilc28 Profile Picture
    13 on 31 Oct 2023 at 11:12:29
    Re: Formatting a specific table with CSS

    Hi Sudeep,

     

    Thank you for offering your assistance with this! Screenshots as per below: -

     

    Flow OverviewFlow OverviewGet-Items from Sharepoint List and Create HTML Table actionGet-Items from Sharepoint List and Create HTML Table actionCSS Styling with Table Output AppendedCSS Styling with Table Output AppendedHTML Email Content #1HTML Email Content #1HTML Email Content #2HTML Email Content #2

  • SudeepGhatakNZ Profile Picture
    14,318 Most Valuable Professional on 31 Oct 2023 at 10:47:12
    Re: Formatting a specific table with CSS

    Please upload a screenshot of your flow

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 14

#2
Churchy Profile Picture

Churchy 12

#3
rzaneti Profile Picture

rzaneti 10 Super User 2025 Season 1

Overall leaderboard