Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Is it possible to change CSS selectors such as :hover. :active, ::after with the `style` keyword?

How do I change those selectors from python? For example, this doesn’t seem to work:

html.Button(
    “Name”,
    style={
        ‘background-color’: ‘transparent’,
        ‘border-color’: ‘transparent’,
        ‘color’: ‘#000000’,
        ‘:hover': {'background-color’: ‘#ff1100’}
})

this is a more general question, following up from: Button (and other components) override css for hover

It isn’t unfortunately. This is a limitation of the JavaScript api so it’s not easy for us to change. You’ll need to use css style sheets for this.

But isnt style React-Based? I read somewhere that in React you can set hover in style.

Not in pure react. There are 3rd party react components and plugins that support this but they haven’t been ported to dash.