I was trying to create a modern browser mockup in TinyMCE with three colored circles like this:
Code: Please login/register for access
…but TinyMCE kept removing the empty Code: Please login/register for access elements.
The issue: TinyMCE automatically strips empty inline elements, even if they have classes. There’s no config option to allow truly empty spans globally.
✅ The reliable fix is to make each span non-empty, but without showing any visible text. Use a zero-width space (Code: Please login/register for access) like this:
Code: Please login/register for access
Code: Please login/register for access is invisible, so your CSS circles still render.- TinyMCE now sees the span as non-empty, so it won’t strip it.
This is the standard approach for decorative elements in TinyMCE.
You can check out the finished product on our homepage :-)