Skip to main content

Add & Configure Custom HTML Item

Use the Custom HTML block in Omnisend's Email Builder to add your own code, widgets, and styling to email campaigns and automation

Ira avatar
Written by Ira
Updated this week

The Custom HTML block lets you add your own code to emails in Omnisend's Email Builder. Use it to embed third-party widgets, apply custom styling, or insert advanced content elements like countdown timers.

Two ways to use custom HTML in Omnisend:

  • HTML block (drag-and-drop in Email Builder): Add code snippets within an email. Use for widgets, tables, or custom CSS.

  • Import HTML template (Store Settings → Saved Templates): Upload a complete email design coded externally. Learn more: Import HTML Template

This article covers the HTML block workflow for Email Campaigns and Automation Workflows.


Before You Begin

  • You'll need working knowledge of HTML and inline CSS. The HTML block requires manually writing or editing code.

  • The HTML block only supports body content. Remove <!DOCTYPE>, <head>, and <body> tags before pasting code.

  • Not all HTML tags are supported. Elements like <iframe>, <script>, <div>, and <font> won't work. See the full list of supported tags below.

  • Always test your email by sending to yourself before launching. Rendering varies across Gmail, Outlook, Apple Mail, and other clients.

Before adding HTML, check:

  • Remove <!DOCTYPE>, <head>, and <body> tags – the HTML block only supports body content

  • Paste from a plain text editor or use 'Clear Formatting' if copying from Canva, Word, or visual editors

  • Keep empty <p></p> tags even if unused – they're required for validation

  • Ensure image URLs start with https:// and are publicly accessible

Add a Custom HTML Block

1. In Email Builder, open the Add Elements menu and drag the HTML block into your email content.

2. Click the HTML block to open the HTML editor on the right sidebar.

3. Paste or write your HTML code in the editor.

4. Click Save.

The HTML block lets you add custom code like countdown timers, tables, and widgets. Use inline CSS for styling and test your email before sending. 

💬 Learn more about the Basics of Email HTML.

Allowed HTML Tags and Supported CSS Elements

To ensure your emails are compatible with major email clients, the HTML block supports only a limited set of HTML tags, attributes, and CSS styles.

⚠️ Note: The HTML block supports only the <body> part of the email. The <head> section should be left out.

Supported HTML Tags

<a>, <p>, <br>, <span>, <hr>, <ul>, <li>, <ol>, <u>, <strong>, <em>, <s>, <sub>, <sup>, <pre>, <h1>, <h2>, <h3>, <img>, <table>, <tr>, <td>

View full list with attributes:

HTML tag

Supported

Notes/limitations

<a>

✅ Yes

Links are supported across all major email clients

<strong>

✅ Yes

Renders as bold text

<b>

✅ Yes

Same rendering as <strong> in most clients

<em>

✅ Yes

Renders as italic text

<i>

✅ Yes

Same rendering as <em> in most clients

<u>

✅ Yes

Underline support varies slightly by client

<del>

✅ Yes

Strikethrough support may vary visually

<s> / <strike>

✅ Yes

Same behavior as <del>

<span>

✅ Yes

Inline styles only

<p>

✅ Yes

Paragraph spacing may differ by client

<br>

✅ Yes

Line breaks are supported

<ul> / <ol> / <li>

✅ Yes

Indentation and spacing vary by client

<h1><h6>

✅ Yes

Font size and spacing may differ by email client

<img>

✅ Yes

Images must use absolute URLs

<table>

✅ Yes

Recommended for layout

<thead> / <tbody> / <tfoot>

✅ Yes

Structure supported; styling may vary

<tr> / <td> / <th>

✅ Yes

Widely supported

<div>

✅ Yes

Use with caution for layout

<hr>

✅ Yes

Styling is limited in some clients

While these HTML tags are supported in Omnisend emails, rendering may vary between email clients (such as Gmail, Outlook, Apple Mail, and mobile apps).

Supported Link and Style Elements

Support for the <link> HTML element

Usage

Supported

Notes

<link> in <head>

❌ No

External stylesheets are ignored or stripped by most email clients

<link> in <body>

❌ No

Not supported in email HTML

Important: Email clients do not support external CSS files. Any styles added using <link> tags will be ignored.

Best practice: Always use inline CSS or, in limited cases, a <style> block.

<style> element in emails

Usage

Supported

Notes

<style> in <head>

⚠️ Partial

Supported in many clients, but not all

<style> in <body>

⚠️ Partial

Can be stripped or ignored by some clients

Important limitations:

  • Outlook (Windows) has limited CSS support even when <style> is allowed

  • Some email clients move or rewrite <style> blocks

  • CSS inside <style> blocks may be ignored in parts

Best practice:
For the most reliable rendering:

  • Use inline CSS whenever possible

  • Use <style> blocks only for simple, non-critical rules

  • Avoid relying on <style> blocks for layout or responsive behavior

Supported CSS Properties

The HTML block supports inline CSS only (via style= attributes).

Supported CSS categories:

  • Background properties

  • Box and border properties

  • Text properties

  • Table properties

  • Media queries

Supported CSS background properties

CSS property

Supported

Notes/limitations

background-color

✅ Yes

Fully supported across email clients

background-image

⚠️ Partial

Not supported in Outlook (Windows). Use fallback background colors

background-position

⚠️ Partial

Ignored by some Outlook versions

background-repeat

⚠️ Partial

Inconsistent behavior in Outlook

background-size

⚠️ Partial

Not supported in Outlook (Windows)

Tip: Always set a background-color fallback when using background images.

CSS box & border properties

CSS property

Supported

Notes/limitations

border

✅ Yes

Fully supported

border-radius

⚠️ Partial

Not supported in Outlook (Windows)

border-image

❌ No

Not reliably supported

box-shadow

❌ No

Ignored in many clients, especially Outlook

width

✅ Yes

Fully supported

height

⚠️ Partial

Can behave inconsistently in Outlook

max-width

⚠️ Partial

Not supported in Outlook (Windows)

min-width

⚠️ Partial

Not supported in Outlook (Windows)

Tip: Use table-based layouts with fixed widths for the most consistent results.

CSS media queries

CSS feature

Supported

Notes/limitations

@media

⚠️ Partial

Not supported in Outlook (Windows) or Outlook.com

(max-width)

⚠️ Partial

Ignored by Outlook (Windows)

(min-width)

⚠️ Partial

Ignored by Outlook (Windows)

(max-device-width)

⚠️ Partial

Not supported in Outlook

Important: Responsive design works best in Apple Mail, Gmail mobile apps, and Yahoo Mail, but not in Outlook (Windows).

CSS text properties

CSS property

Supported

Notes/limitations

font-family

✅ Yes

Use web-safe fonts only

font-size

⚠️ Partial

Outlook may override values

font-weight

⚠️ Partial

Some weights may not render as expected

font-style

✅ Yes

Fully supported

font-variant

⚠️ Partial

Limited support

letter-spacing

⚠️ Partial

Can be ignored in some clients

line-height

✅ Yes

Widely supported

text-align

✅ Yes

Fully supported

direction

⚠️ Partial

Inconsistent support

@font-face

❌ No

Not reliably supported across clients

Tip: Stick to system fonts like Arial, Helvetica, Georgia, or Times New Roman.

CSS table properties

CSS property

Supported

Notes/limitations

border-collapse

⚠️ Partial

Outlook has inconsistent behavior

border-spacing

⚠️ Partial

Not supported in Outlook (Windows)

empty-cells

⚠️ Partial

Limited support

Best practice: Use HTML table attributes (cellpadding, cellspacing) instead of CSS where possible.

Additional Notes

  • Omnisend Support cannot assist with custom code issues. If your custom element doesn't display as expected, reach out to the provider of the code snippet or consult a developer.

  • Always test before sending. Email rendering varies across clients (Gmail, Outlook, Apple Mail, etc.).

Troubleshooting

My HTML block disappears or won't save. What's wrong?

Your code contains unsupported tags or encoding issues.

To fix:

  • Copy your HTML and paste it into htmlcorrector.com, then paste the cleaned version back into Omnisend.

  • If you copied from Word, Canva, or another editor, select the text in Omnisend and click Clear Formatting before saving.

  • Check that you haven't removed required <p></p> wrapper tags – they're needed for validation even if empty.

Unsupported tags that cause errors:
<iframe>, <script>, <div>, <font>, <video>, <audio>, <object>, <embed>

Preview shows blank even though code looks correct in the builder.

Blank previews usually mean image URLs are missing https://, or you've removed required wrapper tags.

To fix:

  • Verify all image URLs start with https:// and are publicly accessible.

  • Check that <p></p> tags are present (even if empty).

  • Test with simple HTML first: <p style="color:blue;">Test</p>. If it works, add your full code gradually to isolate the problem.

Can I edit the full HTML code of my entire email (not just the HTML block)?

No. Omnisend's Email Builder is visual-first and doesn't provide a raw HTML editor for the entire email.

You can only edit HTML within individual Custom HTML blocks.

To edit full email HTML:

  1. Open your email in Email Builder.

  2. Use browser Inspect → view #document → copy full HTML.

  3. Edit the HTML externally.

  4. Re-import via Store Settings → Saved Templates → Import Template → Paste HTML Code.

I'm using CSS !important to control dark mode colors, but it's not working.

Email clients like Gmail, Outlook, and Apple Mail override CSS in dark mode regardless of !important declarations.

Recommendation:
Design your email to look good in both light and dark modes. Test using Preview → Dark Mode toggle before sending.

⚠️ Note: Dark mode behavior is controlled by the recipient's email client, not your code. Some clients invert colors automatically; others apply selective adjustments.

I get an error that says "Your HTML code needs adjustments." How do I find the specific problem?

Omnisend doesn't highlight the exact line causing the error.

To fix:

  • Use htmlcorrector.com to automatically fix common issues.

  • Manually check for unsupported tags like <iframe>, <script>, <div>, <font>, <!DOCTYPE>, or <head>.

  • Try pasting simple test HTML (e.g., <p>Test</p>) to confirm the block works, then add your full code in sections.

Use Cases

Countdown Timers

You can add countdown timers to Email Campaigns or Automation Workflows using the Custom HTML block.

Choose your setup:

  • Email Campaigns: Static countdown timer (fixed end date/time)

  • Automation Workflows: Dynamic countdown timer (calculates from send time)

Countdown Timers in Email Campaigns

Step 1: Drag and drop the HTML block into your email template.

Step 2: Create a countdown timer:

  • Go to Sendtric and generate a countdown timer.
    ⚠️ Note: Sendtric requires a paid plan for active countdown timers.

  • Click Generate and copy the code.

Step 3: Paste the code into the HTML block in Omnisend and click Save

To center the timer:

  • Find style="display: block;"

  • Replace with style="display: block; margin-left: auto; margin-right: auto; width: 50%"

To make the timer dynamic (count from send time):

Add [[ current_date | date: "%s" | plus: 86400 ]] to the image URL.

This function converts the current date/time to seconds and adds 86400 seconds (1 day) to the send time.

Example:

<img src="http://gen.sendtric.com/countdown/vtkfdyi20u?to=[[ current_date | date: '%s' | plus: 86400 ]]" style="display: block;" />

You can change 86400 to any number of seconds. For example:

  • 86400 seconds = 1 day

  • 172800 seconds = 2 days

  • 604800 seconds = 7 days

💡 Free alternatives: NiftyImages offers free dynamic timers. You can also use our third-party integration: Essential Email Countdown Timer.

Countdown Timers in Automation Workflows

For Automation Workflows, you need a dynamic timer that calculates the expiration date each time the email is sent.

Recommended tool: NiftyImages (free plan available)

💬 Watch the NiftyImages Video Guide to familiarize yourself with dynamic timers.

Example use case: Add a dynamic countdown timer that expires when a discount code expires (2 days after email is sent).

Note! To make the countdown timer dynamic, check the 'Email merge tag' checkbox.

💬 We recommend watching the NiftyImages Video guide to familiarize yourself with dynamic timers and how they work.

Let's add our timer based on a specific use case: imagine you want a dynamic timer that expires at the end of the sale (using a discount item).

Step 1. Create your automation in Omnisend → Open Email Builder and add a discount block for your sale. Set the expiration date for your discount, which will be the same as the expiration date for your timer.

Important! In Shopify, the discount code expires at 12:00 AM on the date you select in Omnisend. So you need to adjust the countdown timer to match that expiration date.

Step 2. Add an HTML code here with a countdown timer showing when the discount code expires. Copy the Year-Month-Day and Timezone Offset HTML from Nifty images and add it to the HTML Item in Omnisend.

Now you need to change the date format to the Omnisend date format. Find the date in your code. You will see there is a dash between each personalization tag, which you will replace with Omnisend dynamic date tags.

Remove the date part from the code and insert Omnisend personalization tags:[[current_date | date:'%Y']]-[[current_date | date:'%m']]-[[current_date | date:'%d']].

Once replaced, the date will show zeros, but when the email is sent out, an actual date will be shown here because we added personalization tags.

Step 3. Adjust the timezone. In personalization, you will see a time zone set to Greenwich time. You need to change it to the timezone of your account. As shown in the screenshot below, change "T00:00:00-07" to "T00:00:00+2," etc., based on your timezone.

Step 4. Your timer is set to today's date, but you also want it to count dynamically till the end of your sale (discount expiry is set to 2 days).

For example, if your discount code expires in 2 days, you need your timer to run dynamically for 72 (it doesn't count today, so you need to add 24h to 2 days).

For this, go to Niftyimages, copy this code, return to the HTML item in Omnisend, and place it right after the format tag. Please note that the number of hours should be adjusted based on your sales duration. If your discount expires in 10 days, you must put 264 (240h+24h).

Here's an example of code pasted in Omnisend:

That's it; you've set the timer to run till the end of your promotion. Please remember that you can only test automation by triggering it yourself.

⚠️ Testing: You can only test Automation Workflows by triggering them yourself (e.g., placing a test order).

Importing HTML from Canva

If you designed your email in Canva and want to import it as a full template:

  1. Export your Canva design as HTML.

  2. Open the HTML file in a text editor (e.g., Notepad, TextEdit).

  3. Delete the <!DOCTYPE> declaration and the entire <head> section.

  4. Copy the remaining code and paste it into htmlcorrector.com to clean it.

  5. In Omnisend, go to Store Settings → Saved Templates → Import Template → Paste HTML Code.

  6. Paste the cleaned HTML and save.


Any general questions? Feel free to reach out to our support team. We're available via in-app chat and at [email protected].

Did this answer your question?