How do I remove the empty space where dynamic content would be displayed elsewhere?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
I am creating an email utilizing dynamic content. Within the larger email I have 5 separate sections that will display depending on the specified contact fields. Some people may see 1 of these sections, some may see 2, and some may see none. But when I've tested, I'm seeing big spaces where the non-applicable dynamic content would go. Example: I am a contact that should see sections 1 and 3 of the dynamic content. I receive the email and can see sections 1 and 3 but there is a big space between 1 and 3 and an even bigger space between 3 and the end of the email, where sections 4 and 5 sit in the email template. Is there a way to remove this space so the email stacks without interruption?
Photo of Allie


  • 13 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 0
  • 1
Photo of Sam Collis

Sam Collis, Customer Support Specialist

  • 252 Posts
  • 59 Reply Likes
Official Response
Hi Allie,

It looks like you already sent that mailing out - so my apologies that we weren't able to get back to you in time.  I'd still like to run through a couple of things though for future iterations of your use of Dynamic Content.

I took a look at that mailing and ran some tests to find those large, somewhat inconsistent spaces that appear between content blocks as you described and it looks like there are a couple of things at play here.  Although it looks like the white space appearing represents the hidden content, it's actually a combination of where the hidden Dynamic Content code exists, the default spacing that occurs using bullet points, and a few extra hidden spaces in the text boxes.   We can't remove the space completely but I'll explain how we can make it a bit smaller, and consistent below:

The first thing you can do to help alleviate white space when stacking IF statements is to combine the lines into the same HTML block.  so for example:
[% end if %]
[% if member:field ==  "x" %]

[% endif %][% if member:field == "x" %]

This will eliminate one line of white space.

Secondly, a few of the text boxes ended with hidden spaces in the HTML which was contributing the the inconsistency of space between them  --  you can view the HTML of the textbox by clicking on the " < / >" button in the toolbar when a textbox is selected.  By removing them, minimizing the margins for each box, and using the above technique I was able to diminish the white space to about 2.5 lines (see the middle copy below). It was still larger than the above bullet points contained in the one text box above but rendered consistently.    The smallest margin I could create was when I removed the bullet points. This removed the default spacing added when rendered and brought the margin down to about 2 lines (see the left copy below) with the remaining space representing the hidden Dynamic Content code which can't be removed.

I've made a screenshot which hopefully highlights the difference in spacing using content block #1 and #3 here:

The left and right image both represent the amalgamation of the end if/if statements and the removal of hidden spaces, with the image on left simply not using bullet points.  The image on the right represents the original and the blue line shows the difference in margins.  These are all taken from my inbox using Gmail.

If bullet points are essential to the look of your mailing, one workaround you could use is to copy and paste the "•" symbol in, avoiding the use of HTML tags for those last few text boxes to keep spacing relatively tight, you could also increase the spacing of the first textbox by 1 space to keep it looking consistent.

I hope that helps for next time, please let me know if you have any questions on this!