I'm sending email with ColdFusion's <cfmail>
tag. Most of it is working just fine. However, I am sending through a formatted report which is misaligning the subtotals. I have put the text-align:right
specifically in the code:
<td class = "repcolrow"
style = "text-align: right;
vertical-align:top;
padding-top: 10px
color:##630D85 " >
<a class = "repbordtop"
style = "position:relative; top:4px; text-align: right">
#formq#
</a>
</td>
but after emailing I'm getting text-align:left
. The report as it appears before sending through email is correct:
The report as it appears after being emailed:
Since the text-align: right
is specifically in the code, it is hard to understand why it is aligning left after going through the email. I have checked all the classes referenced, and none of them include any text-align
. I need the <a
references to get the formatting right on the the actual number (#formq#
).
Does anyone have a suggestion about where I could look to find the cause of the text-align: left
?
This is not related to Coldfusion at all. It will send whatever you tell it to, but the mail client is free to ignore it-and they all do.
Every mail client is different, but the following is true pretty much across the board: only a very small subset of css styling is available; no css positioning works.
If you want to make good looking emails, you need to code like you live in the late 90s with HTML4. If you want layouts, they need to be table-based. <font>
tags are more reliable than css. The css you can use needs to all be inline. It's not pretty, but there is no alternative.
(This is especially true in web-based clients like GMail, because if they let emails mess with positioning, it would probably be possible for an email to put bits of the email over parts of the GMail UI. In a client like Outlook, you can look at the raw source of the email to know what was sent to you, even if it won't display it all, but GMail will strip anything unsupported right out.)