Resource icon

Guest Specific Styling

Steve

Fanatic
Joined
Apr 17, 2009
Messages
3,710
Steve submitted a new resource:

Guest Specific Styling - Style elements different for guest easily

XenForo adds a class by default to the html that allows you to target guest with CSS. Examples of use below ;)

In the PAGE_CONTAINER template is where you will find the conditional that adds our class.

HTML:
{xen:if {$visitor.user_id}, 'LoggedIn', 'LoggedOut'}

The first argument says if the visitor's user id is logged in apply the LoggedIn class otherwise apply LoggedOut class (guest).

ai.imgur.com_KTQpvUB.png

You can target many things besides just styling...

Read more about this resource...
 
Last edited:

Indianparents

Enthusiast
Joined
Jun 11, 2014
Messages
247
Steve,
Do I add this to extra.css? I added it to extra.css and the tab is still visible for guests.

.LoggedOut .navTab.postRatings {
display: none;
}
Thanks.
 

Steve

Fanatic
Joined
Apr 17, 2009
Messages
3,710
Something is giving it some inline styling, try adding !important to it/.
 

ozzy47

Tazmanian Master
Joined
Oct 18, 2013
Messages
8,960
Also, make sure you are adding it to the end of the extra.css, to ensure nothing else is overriding it.
 
Top