Iphone Developer Iphone Developer - 5 months ago 17
HTML Question

Using CSS & HTML with MFMailComposeViewController

My CSS formatting is lost when i use it with MFMailComposeViewController. Below is my sample code. I just insert my table data under the body section.

<html>
<head>
<style type="text/css">
#customers {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
width: 100%;
border-collapse: collapse;
}
#customers td,
#customers th {
font-size: 1em;
text-align: right;
border: 1px solid #999999;
padding: 10px 25px 5px 25px;
}
#customers th {
font-size: 1.1em;
text-align: center;
padding: 10px 25px 5px 25px;
background-color: #ffffff;
color: #000000;
}
</style>

</head>

<body>

%@

</body>

</html>


I am setting the "isHTML=YES" while composing the email. Am i missing something or is this method of using CSS not supported on the iphone using MFMailComposeViewController

Answer

I'm not clear, but are you putting your CSS inside the <body> or <head>? I believe MFMailComposeViewController needs to have CSS defined inside the <body></body> tags.