The WPFolks app is out on iPhone. Free, no ads. Download on the App Store
Skip to main content
Login Join
Snippet · CSS

Prevent Empty Elements from Taking Space

Shared by Hiral solanki · September 17, 2026

4 views
1 upvote
Back to Snippets

Automatically hides empty elements, which is particularly useful for WordPress templates where optional ACF fields may leave empty containers.

.element:empty {
    display: none;
}
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments