JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Text Boxes & Inputs › css on blazor componet not applying › Reply To: css on blazor componet not applying
Hi Patrick,
The Blazor CSS Isolation works by attaching a random attribute to the HTML element that works as a selector. However, our controls are generated dynamically and then selector key is lost. The trick is to wrap the blazor controls in a normal HTML element such as div, span or p. In this way, the selector key will be attached to the wrapper HTML and the inner controls will remain selectable. For example:
parent.razor:
<Child/>
child.razor:
<div><Button>Test</Button></div>
child.razor.css:
::deep smart-button {
background: red;
}
OR(if you wish to be more specific):
div ::deep smart-button {
background: red;
}
This creates a red button. I hope this was of help!
Please feel free to contact us again, if you need further support
Best Regards,
Ivan Peevski
Smart UI Team
https://www.htmlelements.com/
- This reply was modified 1 year, 11 months ago by ivanpeevski.
- This reply was modified 1 year, 11 months ago by ivanpeevski.