Hello,
I’m trying to send an email using ‘Create HTML Content’ to write a datatable in the body.
I tried to format this table by inserting CSS but the result isn’t what I expect.
This is the table:
<TABLE height=100 cellSpacing=0 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TH>Header 1</TH>
<TH>Header 2</TH>
<TH>Header 3</TH></TR>
<TR>
<TD>Content 1.1</TD>
<TD>Content 1.2</TD>
<TD>Content 1.3</TD></TR>
<TR>
<TD>Content 2.1</TD>
<TD>Content 2.2</TD>
<TD>Content 2.3</TD></TR>
</TBODY></TABLE>
And the CSS:
<STYLE type=text/css>
body {
font-family: Arial;
font-size: 12px;
color: black;
}
p {
margin: 0;
}
.mapping {
background-color: #D3D4D7;
padding: 1px;
}
table {
text-align: center;
font-size: 11px;
border-width: 1px;
border-style: solid;
border-color: black;
border-spacing: 10px
}
tr:nth-child(odd) td {
background-color: #5b9bd5;
}
tr:nth-child(even) td {
background-color: #95bee3;
}
th {
background-color: #004080;
color: white;
font-size: 12px;
}
</STYLE>
I expect the table to have alternate colored rows but somehow they stay white as you can see (screen from inside the Create HTML Content activity preview).
Here is the final code to be sent by email:
@"<HTML><HEAD>
<STYLE type=text/css>
body {
font-family: Arial;
font-size: 12px;
color: black;
}
p {
margin: 0;
}
.mapping {
background-color: #D3D4D7;
padding: 1px;
}
table {
text-align: center;
font-size: 11px;
border-width: 1px;
border-style: solid;
border-color: black;
border-spacing: 10px
}
tr:nth-child(odd) td {
background-color: #5b9bd5;
}
tr:nth-child(even) td {
background-color: #95bee3;
}
th {
background-color: #004080;
color: white;
font-size: 12px;
}
</STYLE>
<!-- Instruct the web browser control to use IE 6 to render the page. -->
<META content=IE=6 http-equiv=X-UA-Compatible></HEAD>
<BODY>
<P style=""MARGIN: 0px""><FONT face=Arial></FONT> </P>
<TABLE height=100 cellSpacing=0 cellPadding=0 width=""100%"" border=1>
<TBODY>
<TR>
<TH>Header 1</TH>
<TH>Header 2</TH>
<TH>Header 3</TH></TR>
<TR>
<TD>Content 1.1</TD>
<TD>Content 1.2</TD>
<TD>Content 1.3</TD></TR>
<TR>
<TD>Content 2.1</TD>
<TD>Content 2.2</TD>
<TD>Content 2.3</TD></TR></TBODY></TABLE></BODY></HTML>"
Before sending the email, I use ‘Write Text File’ to create a .html file. The .html is good but not the email sent.
HTML file saved:
Email sent (the default background of the mail is light blue):
Why are the results different?



