Elementor adds a bottom margin to every paragraph inside the Text Editor widget by default, which means even the very last line in a block gets unnecessary space beneath it.
That tiny but annoying extra gap in the last paragraph can mess with your spacing and make the layout feel a bit off. This snippet fixes that by removing the margin only from the last paragraph.
You keep your normal paragraph spacing, but the widget no longer leaves that awkward empty space at the bottom.
Copy & paste the scripts before the </body> tag of your project. If you added them before for another setup, skip this step.
Right-click in Elementor, choose “Paste from another site,” and while the popup is open, press cmd/ctrl + v to insert the layout.
Place the code in an HTML widget or add it through Elementor → Custom Code (before the closing </body> tag) either globally or only on selected pages.
Paste the code through the page or site settings, or add it via Elementor → Custom Code (before </body>) for broader use.
.elementor-widget-text-editor p:last-child {
margin-bottom: 0 !important;
margin-block-end: 0 !important; /* Optional */
}Paste the script through Elementor → Custom Code (set to load after </body>) for site-wide or page-specific loading.
Place the PHP snippet inside your theme’s functions.php or using any code snippet to enable logic.