How to fix the width of html table in email?

0
Hello,   I am using the "Create String Variable" activity in a microflow to create some html tables and use them via placeholders in email templates. One table I created expands horizontally based on the length of the string I feed into it, but I don't want that. I would like to set a fix width to the table and allow it to vertically expand if the text is too long.
asked
2 answers
2

Hi Elif,

Please try like below, 

<table style="width:100%;">
   <tr>
      <th style="width:600px;">Animal</th>
      <th style="width:200px;">Habitat</th>
      <th style="width:200px;">Diet</th>
   </tr>
   <tr>
      <td>Lion</td>
      <td>Savanna</td>
      <td>Carnivore</td>
   </tr>
   <tr>
      <td>Eagle</td>
      <td>Mountains</td>
      <td>Carnivore</td>
   </tr>
   <!-- Additional rows and cells -->
</table>

Hope it helps!

Thanks & Regards,

Manikandan K

answered
1

Hello Elif,

Try to pass dynamic class based on text length

 

<table style=if length(text) >100 then ‘dynamic-width’ else ‘fixed-width’>

<tr>   

<td>Column 1</td>   

<td>Column 2</td>

  </tr>

</table>

 

 

Dynamic Class

 

.fixed-width{

width:100px or use css prowhat you want

}

 

.dynamic-widht{

width:500px or use css property what you want 

}

answered