Search code examples
htmlcsswordpresstinymce

How to stop Wordpress TinyMCE from stripping content of empty html tags e.g. <div class="any class"></div>


I'm displaying some content in two columns in a Wordpress post, so I've got two divs displaying half each:

<div class="half">Left column.</div>
<div class="half last">Right column.</div>

But of course I also need to clear this, which I usually do with this afterwards:

<div style="clear:both;"></div>

but this keeps getting stripped out whenever I save the article or view the visual editor as well as any other empty html tags e.g. icons. Is there a better way to do this?


Solution

  • Yes, I'd recommend using the Clearfix technique:

    See: