27
Views
10
Comments
[Multi Theme Reactive] CSS Override is not getting appiled
multi-theme-reactive
Reactive icon
Forge asset by Experts
Application Type
Reactive

I want to ovverride the css of my theme but it is not taking effect in the screen 
The css is to just change the background color of an accordion item


This is the css being applied in run time 


Any ideas? 

UserImage.jpg
Łukasz Kaproń

Hi @BabyBear 

Did you try to use "!important" property?


.osui-accordion-item {

    background-color: var(--color-background-body) !important;

}

2023-02-13 15-34-45
BabyBear

tried it as well

2025-11-18 12-43-07
Mariana Junges
Champion

Please, this is not good practice.

2023-02-19 05-11-08
Faais

Hi, 

There are several ways you can override the theme styles: 
 
Add an extended class to the accordion item, like "accordion-item-new": 

.accordion-item-new.osui-accordion-item{
background-color: var(--color-background-body);
}

or

Write your CSS in the theme instead of the web block. This gives it higher specificity.

or 

Use a parent class for the container, then reference it in your styles: 

.parent-class .osui-accordion-item{
background-color: var(--color-background-body);
}


Finally, if none of the above methods work, you can try using !important:
However, I don’t recommend using !important as it’s not considered a best practice for handling theme styles, It's better to manage specificity properly whenever possible. 



Also, make sure to check your base theme — confirm whether OutSystemsUI is properly added as the base theme in your application. If it's missing, your styles might not behave as expected. 

2023-02-13 15-34-45
BabyBear

I am using the multi theme forge component. the theme is being loaded just not the overrides 

2023-02-19 05-11-08
Faais

Check out this OML.

Test1.oml
2022-09-05 08-23-51
Naveen N

@BabyBear  Your theme is not loaded, i can see from the image only the css are coming from the outsystemsui, try to use the same css in your page level , you can see the working code, then you can debug why the theme is not getting rendered, maybe the base theme you might need to change. if i get more inputs i can identify the issue exactly and help you to resolve it.

2022-09-05 08-23-51
Naveen N

@BabyBear  It is not working bcz, it is not loaded there. are you able to see any css from the place where you kept this code (Module where you placed the css)

osui-accordian-item{

background-color:var(--color-background-body);

}can u please confirm.

2023-02-13 15-34-45
BabyBear

Yes that's is the issue that i am facing in the multi theme Forge component. Unfortunately i cannot share our OML.  basically the issue is if i add custom css on my theme and use the multi theme forge component to change the Theme in run time. it is not loading all the added CSS 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.