Placing an image inside a <$description$> field

Hi folks,

I'm wondering if there's an established technique for getting a <$description$> field's text content to wrap around an image. The problem I'm currently having is that because the <$description$> field creates its own HTML tags (<p> tags and the like), I'm ending up with extra problematic HTML in my emails. For example, here's the code I'm using:

<p><img src="<$imagesrc link='false'" width="100" align="left" /><$description$></p>

Which gives the output:

<p><img src="picture.jpg" width="100" align="left" /><p>Description field text here</p></p>

Note the nested paragraph. I'd like to be able to create a single paragraph tag, with the image aligned left inside the paragraph of text. This sample bit of code is within my <repeater> section.

Does anyone have any advice on how to achieve this? Is there a way to nest the <img> tag within the <$description$> tag?


mikecron, 7 years ago

This wouldn't be as much of a problem if there was a way to get rid of the top margin on the auto-generated paragraph tag.

Any thoughts?

fyredefyre fyredefyre, 7 years ago

Your best bet is to customise the paragraph style and use a custom <P> class and set the margin of your own choice. This aside, I agree the pre-generated tag is frustrating when implemented by default. - Everything Email.
Email: Skype: fyredefyre
davidaf davidaf, 7 years ago

Hi all. In this case I would suggest not wrapping a paragraph around the entire thing. If you need to block it out, use a <div> instead to avoid the nested paragraph tags, then you can define margin-top 0 for paragraphs to close that gap:

p {margin-top:0;}

The margin element is fairly well supported.

The Campaign Monitor Blog – HTML email smarts to go with your good looks

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free