# How to display a banner for visitors only?

**URL:** https://meta.discourse.org/t/how-to-display-a-banner-for-visitors-only/87800
**Category:** Support
**Created:** [18 mei 2018 om 04:41 UTC](https://meta.discourse.org/t/how-to-display-a-banner-for-visitors-only/87800 "2018-05-18T04:41:14Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [18 mei 2018 om 05:15 UTC](https://meta.discourse.org/t/how-to-display-a-banner-for-visitors-only/87800/2 "2018-05-18T05:15:08Z")

</div>

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

> [@Banner Topic on home page and only for anonymous users](https://meta.discourse.org/t/banner-topic-on-home-page-and-only-for-anonymous-users/80959/5):
>
> So for example, in your customizations if you add HTML content (Admin \> Customize \> Themes \> Edit HTML/CSS \> Header/After Header/Footer): \<div class="anon-content"\> \<p\>This is test content\</p\> \</div\> You can then add this to your CSS so that content only shows for anon users: .anon-content { display: none; } .anon .anon-content { display: block; } If you wanted to go further and only show that content for anon users on the category page, you could use this CSS: .anon-content …

The selector in your case would be inverted like so:

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

```

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

---

_[View the full topic](https://meta.discourse.org/t/how-to-display-a-banner-for-visitors-only/87800)._
