Legacy Email Builder - HTML Block


This article applies to:

You are able to add snippets of HTML code into your email using the HTML block. This guide is going to review the type of code the HTML block accepts. 

There are a few different versions of HTML. The common version these days is HTML5, which is considered a "loosely" written language. XHTML is an older version is a "strictly" written language, which leaves less room for mistakes.

The BARD builder itself renders in HTML5, but when sending or looking at the preview, the email will render in XHTML. This is because in HTML5, you don't need to use a self-closing tag (though it's a best practice to do so regardless). In XHTML, however, you do. 

All XML Elements Must

  • XHTML Elements Must Always Be Closed
  • Empty Elements Must Also Be Closed
  • XHTML Elements Must Be In Lower Case
  • XHTML Attribute Names Must Be In Lower Case
  • XML tags are case sensitive. The tag <Letter> is different from the tag <letter>

XML Elements Must be Properly Nested

In HTML, you might see improperly nested elements:

<b><i> This text is bold and italic </b></i>  

In XML, all elements must be properly nested within each other:

<b><i> This text is bold and italic </i> </b> 

In the example above, "Properly nested" simply means that since the <i> element is opened inside the <b> element, it must be closed inside the <b> element.

Another example is, instead of doing something like:

<img src="w3schools.com/images/w3schools_green.jpg" alt="image">

You would need to actually close the tag as with a /

<img src="w3schools.com/images/w3schools_green.jpg" alt="image"/>

There are five pre-defined entity references in XML:

&lt;

<

less than

&gt;

>

greater than

&amp;

&

ampersand 

&apos;

'

apostrophe

&quot;

"

quotation mark

Only < and & are strictly illegal in XML, but it is a good habit to replace > with &gt; as well.


White-space is Preserved in XML

XML does not truncate multiple white-spaces (HTML truncates multiple white-spaces to one single white-space):

XML:

Hello           Tove

HTML:

Hello Tove

Source: https://www.w3schools.com/xml/xml_syntax.asp

Helpful tools to clean code:

Paste your code there, and click on "fix IT" this will fix any small errors in the code, and you can use the fixed code in the element, and the errors should be fixed. https://www.htmlcorrector.com/

HTML To XHTML Code Converter:

 http://www.csgnetwork.com/cvthtml2xhtml.html

http://www.cruto.com/resources/code-generators/code-converters/html-to-xhtml.asp


Any links we provide from non-Infusionsoft sites or information about non-Infusionsoft products or services are provided as a courtesy and should not be construed as an endorsement by Infusionsoft.