XF 1.5 Can't get a conditional statement to work in CSS template

Aivaras

Well-known member
I need to set a condition for applying padding to an element. The template in question is "public.css".

My current CSS code is as follows:

Code:
    .message.horizontal .messageUserBlock a.username
    {
        margin-left: -24px;
        padding-left: 9px;
    }

I need "padding-left: 9px;" to apply only when the user chooses to be visible. In order to achieve this I enclosed it in a conditional statement:

Code:
    .message.horizontal .messageUserBlock a.username
    {
        margin-left: -24px;
        <xen:if is="{$user.visible}">padding-left: 9px;</xen:if>
    }

Unfortunately, it's not working. Where is my mistake?
 
You can't use conditionals in CSS. It doesn't have access to user information. You would need to modify the HTML to add a class dynamically to detect what you want and then adjust the CSS to account for that.
 
Top Bottom