Using CSS in Anvil Apps
You can build the front-end of your app entirely in Python using Anvil’s components. However, your app still uses HTML and CSS under the hood.
Anvil components generate HTML. When you change their properties in the Properties Panel or in the Form’s code, the CSS applied to them is updated automatically.
Writing CSS in theme.css
Every Anvil app includes a stylesheet called theme.css. Depending on the theme you choose when creating your app, it may already contain default CSS rules targeting Anvil components. You can write CSS rules here in the traditional way to change a component’s appearance. For example, see Customising the Loading Indicator.
The theme.css file in assets.
Reusing Styles with Roles
To apply consistent styling across multiple components, you can create reusable style classes called Roles. They can be applied to components through the Properties Panel or in the Form code. See Roles to learn how to create and use them.
Do you still have questions?
Our Community Forum is full of helpful information and Anvil experts.