enter image description hereI created an email template in HTML and want to use this for a visual force email template. When inserting the HTML my code gives many syntax errors. When using the same HTML in a regular HTML template everything is fine. Especially with end tags it gives errors. Now im wondering am i doing something wrong or is it not possible to use html on a visual force template??

To give an example:

The element type "img" must be terminated by the matching end-tag ""

1 Answer 1


Visualforce is proper XML, so you must observe the rules as such. In addition, your HTML syntax, while "acceptable" to an HTML parser, is not technically correct. All tags should be "closed," which means that you use the short tag syntax, or you must close that tag with an end tag.

For "img" elements, use the short tag syntax, which means to include a / at the end of the image's tag:

<img src="..." alt="..." class="..." width="..." style="..." />

Note that the short tag has a trailing /; this tells the parser that the tag both opens and closes at the same time. This is true for all other elements that you do not normally "close", such as <br /> and <hr />.

  • simple as that, sometimes you forget the basics :P i did got some more problems but at least i know what is causing this.
    – Jort
    Commented Apr 9, 2019 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .