Link to home
Start Free TrialLog in
Avatar of abuyusuf35
abuyusuf35

asked on

Formatting an HTML Email

Hi - I need to generate an HTML email which has a table of data embedded in it - the table has multiple rows and columns each of them with data of varying lengths - since this email is generated as HTML I am using whitespaces to separate the data in each row  

However the email that is generated does not look uniform and has data in a rows looking jumbled up - I found there is no exact formula so a whitespace entry does'nt necessarily translate to a whitespace in HTML.

Has anyone tried doing this and is there a way of generating a uniform HTML ?

Thanks
Avatar of for_yan
for_yan
Flag of United States of America image

Are you separating the cell in HTML table with <td>stuff</td>?

I put &nbsp; only in those cells which have to be empty between the <td> and </td> tags - otherwise I just put required text between the td tags no matter how different in length it is
- if you have the same nimber of cells in each
row (rwos separated by </tr><tr>) I get uniform tables
Avatar of abuyusuf35
abuyusuf35

ASKER

How about elements within a row ? How can I space them out evenly ? Given that they are different lengths ? Thanks
I don't do anything special - once you have the same number of cells it will adjust each cell to the row which have this cell longest - you'll have of course columns of different type
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dave Baldwin
You would have to give each <td> a width like <td width='50px'>.  Also, in HTML, if you have more than one space ' ', only the first one is displayed.  If you want additional blank spaces, you have to use "&nbsp;" which is the code for 'non-breaking space'.

http://www.sitepoint.com/code-html-email-newsletters/
I tried using &nbsp;but is it not giving me an even row of elements I will try <td width='50px'> that might work
Yes, if you put nothing the cells will be adjusted to the widest across the rows - if your data is of the same length you can put the width everywhere

you can also look here with lots of discussions on how to adjust the width of cells in HTML tables:
http://stackoverflow.com/questions/1057574/html-td-wrap-text