Wordpress block editor leaves empty <p> tags at the end of pages
In an effort to be helpful, the Gutenberg editor sometimes adds an extra empty <p>
tag at the end of your page or post when you edit it. This is related to that “Start writing or type…” prompt you see while you’re editing.
But what if you have some element right after your page, like a coloured block, and you don’t want extra gaps sneaking in?
You could go and fix the problem by overriding some Wordpress filters, but there is a quick solution in one line of CSS:
p:empty { display: none; }
Unless you were using empty <p>
tags for something (…like what?) this should have no side effects. Compatibility is very wide too.