# Similar to conditional rendering , is Conditional Styling of CSS possible?

**URL:** <https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727>\
**Category:** How do I?\
**Created:** [October 4, 2023, 11:35am UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727 "2023-10-04T11:35:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthik](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@karthik](https://community.weweb.io/u/karthik)\
**Post date:** [October 4, 2023, 11:35am UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727/1 "2023-10-04T11:35:52Z")

</div>

For example style changes of a Multi page component depending upon the page you are in

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [October 4, 2023, 12:06pm UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727/2 "2023-10-04T12:06:10Z")

</div>

Hi @karthik 👋

You can use `if` and `switch` statements to style a CSS property differently based on a condition.

Here’s an [example with the `switch` formula](https://youtu.be/H8ZmKz_3bIc) but there are many others.

To change the style of a multi-page section depending on the page you’re on, you can use information about the current page you’re on:

 ![CleanShot 2023-10-04 at 14.05.23@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/648d1877efbcb2e94bfe75148c90909f3c285806.png)

---

<div class="post-metadata">

**Author:** ![karthik](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@karthik](https://community.weweb.io/u/karthik)\
**Post date:** [October 5, 2023, 12:31pm UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727/3 "2023-10-05T12:31:36Z")

</div>

Yeah I can use the page metadata to apply conditioning for multi page elements. But in that video you are altering the background property with a formula but what I wanted to know is to conditionally inject CSS as code at the bottom [Custom CSS option] is there a way ?

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [October 5, 2023, 12:49pm UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727/4 "2023-10-05T12:49:13Z")

</div>

Aaaaah ok ok. Can’t think of one, no.

Can you tell me more about your use case? What would be the CSS styles you’d want to modify with that custom code? Any reason you couldn’t do it in no-code?

---

<div class="post-metadata">

**Author:** ![karthik](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@karthik](https://community.weweb.io/u/karthik)\
**Post date:** [October 5, 2023, 1:22pm UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727/5 "2023-10-05T13:22:48Z")

</div>

I did it in no code now. Its a left border styling 😅

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [October 5, 2023, 1:23pm UTC](https://community.weweb.io/t/similar-to-conditional-rendering-is-conditional-styling-of-css-possible/4727/6 "2023-10-05T13:23:33Z")

</div>

Haha nice one! It’s all in the details 😀
