Multi-line Personalization Help

I'm setting up a campaign that will use custom field personalization to include Name and Address. I want the info to appear like this:

Address 1
Address 2
City, State ZIP

My code for this section looks like this:

<td width="240" height="85" rowspan="2" valign="top" class="address">
[fullname,fallback=]<br />[address1,fallback=]<br />[address2,fallback=]<br />[city,fallback=], [state,fallback=] [zip,fallback=]

If an entry in my list doesn't have a 2nd line address I'm going to end up with an extra line break between the first line address and city/state like this:

Address 1

City, State, ZIP

Any ideas on how to fix this and make it so there would only be one line break in these cases?

davidaf davidaf, 5 years ago

Hi talknmime

I've done some testing on this and it works pretty well if you skip the break tags, but wrap each line in a <div> tag. For the fallback, the empty div tag will result in no break at all and so will appear seamless. Give that a try and see if it works for you:

<td width="240" height="85" rowspan="2" valign="top" class="address">
<div>[city,fallback=], [state,fallback=] [zip,fallback=]</div>

The Campaign Monitor Blog – HTML email smarts to go with your good looks
talknmime talknmime, 5 years ago

Thanks a lot for figuring this out. I've been doing so many emails that I've conditioned myself to work solely in tables. Forgot all about using DIVs. Much appreciated!

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free