Definition
HTML comments are markup annotations that carry instructions without displaying anything. In email, they document code and drive client conditionals.
Well-formed comments are safe, but malformed conditionals can expose content.
HTML comments organise email code and drive client conditionals, keeping complex templates maintainable. Well-formed comments are invisible and safe. Malformed ones can leak content, so validate them.
Using Comments
Use comments to explain complex sections for maintainers.
Client-specific comments drive Outlook conditionals.
Why It Matters
HTML comments organise email code and drive client conditionals. Understanding them keeps complex templates maintainable.
Best Practices
- Use comments to explain complex sections for future maintainers.
- Never put critical visible content inside a comment.
- Ensure comments are well-formed so they do not leak content.
- Use comments for MSO conditionals.
- Keep comments purposeful.
Was this useful?
Related Glossary Terms
Above the Fold in Email
Above the fold in email refers to the content visible to a recipient before they scroll, a critical area for first impressions and primary calls to action.
Accessible CTA (Email)
An accessible CTA is a button or link coded with sufficient colour contrast, visible focus states, descriptive screen-reader text, and a minimum touch target of 44×44 pixels.
Adaptive Design
Adaptive design in email uses predefined layouts that adjust to specific device or client widths, rather than fluidly resizing to every possible screen.
AI-Generated Content in Email
AI-generated content in email is copy, images, code or subject lines produced by artificial intelligence tools to speed up campaign production and testing.
Alt Text
Alt text is the written alternative to an image in an email, displayed when images are blocked, slow to load, or consumed by screen readers.
Autoplay Video in Email
Autoplay video in email refers to the limited ability to play video content automatically when an email is opened, using specific client-supported techniques.
Frequently Asked Questions
No, browsers and clients ignore them when rendering. HTML comments organise email code and drive client conditionals, keeping complex templates maintainable.
Unclosed or malformed conditionals can expose hidden content. Well-formed comments are invisible and safe.
Special comment blocks Outlook interprets for targeting. Malformed ones can leak content, so validate them.
Yes, comments help maintainers. HTML comments organise email code and drive client conditionals, keeping complex templates maintainable.
Only if malformed or abused. Well-formed comments are invisible and safe.