Hello, all. I am trying to use dbc.Button
’s to allow multi-page navigation my app, by utilizing the href=
property that dbc.Button
has (unlike html.Button
which doesn’t have it).
I provide a style to all my buttons, but I noticed that using href
causes some of their style properties to become lost, and I can’t find a way to prevent this change from triggering.
Is there any way to prevent whatever style changes href
likes to cause to Buttons?
A screenshot of my app:
app = dash.Dash()
button_special_style = {‘font-family’:‘copperplate’, ‘font-size’:‘20px’}
app.layout = html.Div(children=[
html.Div(children=[ html.Div("My buttons:"), html.Div(id="Buttons", children=[dbc.Button("Just a plain, simply tailored button", className='regular-button', style={'font-size':'20px'}), dbc.Button("With style", className='stylish-button', style=button_special_style, #href="/button1_clicked" ), dbc.Button("Href removing some style", className='stylish-button', style=button_special_style, href="/button2_clicked" ), dbc.Button("With style", className='stylish-button', style=button_special_style, #href="/button3_clicked" ), dbc.Button("Href removing some style", className='stylish-button', style=button_special_style, href="/button4_clicked" ) ], style={'display':'flex', 'margin-top':'20px', 'flex':'1 0 50px'} ), ], style={'border': '5px solid orange', 'height':'200px', 'width':'500px', 'display':'flex', 'flex-direction':'column', 'background':'white'} ),
])
if name == ‘main’:
app.run_server(debug=True)