The CSS empty
class allows you to style empty elements.
This would be handy to hide elements that are not needed for cards that have blank fields. (As you can set the pseudo-class to display:none
).
At the moment, you can do this by wrapping the fields in an “if statement”. But using the empty class allows for cleaner code in templates.
Example: Here is my a template:
<div class="language">{{Publication}}</div>
.publication {
background: blue;
border: 1px solid black;
margin:20px;
}
.publication:empty {
display:none;
}
If the Publication
field on the card is empty, then the .publication
div will still render, outputting the margin.
But the :empty
class will hide it.
At the moment, you could wrap the div with if tags (e.g. {{#Publication}}<div class="language">{{Publication}}</div>{{/Publication}}
)
But the :empty
class allows for a cleaner more manageable template.