I have a rich text textarea on my vf page that I am populating with the html from an email template. Everything appears correct except the paragraph spacing is double spaced. Does anyone know how to control the vertical spacing? Is it a style element?


There are some inconsistencies between the rich text control and the email template html version. The template editor puts a style in the beginning to limit the

tag spacing.

<style>p{margin-top:0px; margin-bottom:0px;}</style>

I could not simply prefix the body html with the style as the rte control stripped it out. I put code in the controller for all p tag styles to include these entries. Fortunately they were all one of two standard formats.

There also appeared to be unprintable characters that caused an extra

tag in a couple places. Deleting all white space and replacing with only the required spaces and returns seems to resolve that as well.

| improve this answer | |

<p> elements include a 1em space afterwards; it's part of the HTML specs. If you want to have single spacing, use a line break (<br />) instead.

| improve this answer | |
  • The data for the edit object is pulled from an email template which is built with a similar rich text editor. I don't control the html in either case. – Jerry Welliver Jun 4 '18 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.