How To Change Visual Style of Button?

I’m not really a web developer, but I’m thinking this is possible in CSS? For example if I wanted to change the background color of a specific button how would I do this?

For background, you should simply be able to adjust the background property.

For other properties that are not built-in, I suggest creating a role. Give the docs a search for custom roles. They are really flexible.

1 Like

If you want to set it at design time (i.e., in the IDE), then you can use the Properties panel in the visual designer. (You may have to click “More” in order to see that particular setting). See https://anvil.works/docs/editor .

If you want to change it dynamically (i.e., via running code), then check out https://anvil.works/docs/api/anvil#Button_attributes . A button is a Python object, so you can alter its properties directly, via very-straightforward Python code.

I might also suggest Searching Anvil’s Online Help :wink:. A lot of work has gone into Anvil’s documentation, so it’s definitely worth checking out.

2 Likes