Home Forums Feature Requests Remove whitespace in empty .acf-label element


Remove whitespace in empty .acf-label element

    • gavin310

    • September 25, 2020 at 11:31 pm

    When a field’s Label is empty, the resulting HTML element is rendered like this:

    <div class="acf-label"> </div>

    Due to the space in between the opening and closing tags, you cannot use the CSS3 :empty selector to select the empty element, because technically it’s not empty. If the whitespace in the element was removed, we could use CSS such as:

    .acf-field .acf-label:empty {
    	margin-bottom: 0;

    Alternatively, a class could be added to the element, like <div class="acf-label empty"> </div>. This method would be more backwards compatible in case some people are using JavaScript to find .acf-label elements containing only a space and hiding them.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.