Jarvis Jarvis - 1 year ago 142
Twig Question

How to add class if single tag?

I have 4

, which are showed or not.

{% if li == 1 %}{% endif %}

How to add class if only one (single)
is showed?

Answer Source

You could achieve this slightly differently by applying the style only when the element is the single child of it's parent (only one is rendered)

ul li:only-child {
property: value;

link to w3schools article here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download