How to display a banner for visitors only?

Hi,

I need to display a banner at the top of the page, but it should be for visitors only. How to set it to disappear for logged users ?

Thanks

You can make use of the anon class added to the <body> tag. More on this here:

The selector in your case would be inverted like so:

body:not(.anon) {
	#banner {
		display: none;
	}
}

Which effectively hides the banner unless the user is logged out.

9 Likes

This topic was automatically closed after 2213 days. New replies are no longer allowed.