# How to change the div\`background color when user is logged in?

**URL:** <https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921>\
**Category:** How do I?\
**Tags:** design\
**Created:** [February 8, 2024, 2:54pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921 "2024-02-08T14:54:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markus](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/markus/32/7539_2.png) [@Markus](https://community.weweb.io/u/Markus)\
**Post date:** [February 8, 2024, 2:54pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/1 "2024-02-08T14:54:49Z")

</div>

Hi guys. I just want to change a color of a litlle block when the user is logged in.  
Can you help me?  
Thank you.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [February 8, 2024, 4:53pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/2 "2024-02-08T16:53:50Z")

</div>

There is an example of data binding for css styles in the docs

> **[Binding data | WeWeb documentation](https://docs.weweb.io/binding-filtering/binding-concept.html#binding-simple-data)**
>
> Learn how to bind and display external data in your WeWeb app.

---

<div class="post-metadata">

**Author:** ![Markus](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/markus/32/7539_2.png) [@Markus](https://community.weweb.io/u/Markus)\
**Post date:** [February 8, 2024, 7:03pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/3 "2024-02-08T19:03:30Z")

</div>

Thank you Dorilama …Brasileiro? Legal!  
Cara… não deu certo… sou iniciante, to aprendendo… mas não consegui mudar a cor de fundo de uma div quando o usuá faz login… Deve ser simples mas estou me situando ainda…

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [February 8, 2024, 9:55pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/4 "2024-02-08T21:55:25Z")

</div>

I’m not from Brasil 🙃 if you want to change a color if a user is logged in just bind the color value with an expression for that.

---

<div class="post-metadata">

**Author:** ![Markus](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/markus/32/7539_2.png) [@Markus](https://community.weweb.io/u/Markus)\
**Post date:** [February 9, 2024, 11:28am UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/5 "2024-02-09T11:28:19Z")

</div>

Ow sorry 🫠. I thouth that because your nickname means “pain and mud”! - dor(pain) i(and) lama(mud). Ok, I understood, but I don`t know exactly how to do the expression and where to put it!! Could it be in a workflow?

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [February 9, 2024, 11:51am UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/6 "2024-02-09T11:51:37Z")

</div>

> [@Markus](#):
>
> your nickname means “pain and mud

that’s funny 🤣

> [@Markus](#):
>
> I don`t know exactly how to do the expression and where to put it

there is literally a tutorial about this in the docs I linked:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/fbf504cd3cc06a251feb71f3e0daf4067cde27ad.png)  
you just need to select the background color

once you add an [auth method](https://docs.weweb.io/plugins/intro-to-plugins.html#authentication) you will have the data to know if the user is authenticated  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/83731d2cb39f2fae4904563e28a3a1aa1b523b79.png)

you have [conditional formulas](https://docs.weweb.io/formulas/conditional.html#if) to help you building the logic.

This is all in the docs and in the example videos/academy, it’s useful to go through that

---

<div class="post-metadata">

**Author:** ![Markus](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/markus/32/7539_2.png) [@Markus](https://community.weweb.io/u/Markus)\
**Post date:** [February 9, 2024, 12:20pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/7 "2024-02-09T12:20:50Z")

</div>

Ok, dear friend. THank you so much! I`m gonna watch this vídeos more times… Thank you!

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [February 9, 2024, 6:03pm UTC](https://community.weweb.io/t/how-to-change-the-div-background-color-when-user-is-logged-in/6921/8 "2024-02-09T18:03:57Z")

</div>

for referece, one way to do this:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/ce889049c5b1d2d8c088fa179ae2fbcac6a63bab.png)
