Extra line spacing with <p> tags in email client - ServiceNow Community
kim_purcell
Kilo Explorer

If you are trying to create an email notification using the HTML editor, you may find yourself adding excessive space every time you hit return. What's going on here? If you look in the source code, you may see something similar to this:

Screen Shot 2014-12-10 at 3.09.16 PM.JPG

If the email notification content type is HTML, and you use return to create a line break, the HTML editor will insert extra paragraph tags (<p> &nbsp </p>) to your notification, which will cause the gaping white space.

There are some basic ways to fix this issue:

  • If you want to keep lines closer together, hold down the Shift key while you press Return. This creates a single line break, which is <br> in HTML.
  • You can also choose to create the HTML template in a JavaScript/HTML editor first, and then copy that to your email client template.
  • If you're really desperate, just go into the HTML editor and manually delete out the <p> &nbsp </p> to close the space.
  • If you are familiar with CSS, you can apply a new style to the <p> tags to keep paragraphs closer together. For example, <p style="margin: 0px; padding: 0px;"> or <style>p {margin: 0px; padding: 0px;}</style> into the HTML field to set a default value.
  • In addition, when editing an existing notification that contains literal carriage returns, these breaks appear as <div> &nbsp; </div> (<p> tag's mischievous cousin). These can also be replaced with <br> tags to fix the gap.

For more information, see:

ServiceNow KB: Extra HTML "paragraph" tags being added for carriage returns sent in the email client...

Excessive HTML Spacing when using the Email Client (&lt;p&gt; &lt;/p&gt;)

3 Comments