Hello,
I have a fairly simple problem, but its proving to be more difficult than I imagined to solve. I have a graph on the left side of my dashboard (it’s blank for now - doesn’t matter what it is). This graph should take up 50% width of the row. The remaining 50% width in that row should be taken up by 3 cards that I want to have metrics displayed on.
However, when I place the cards in the dashboard, they do not align with the top of the graph. They are pushed down a little. Here is a reproducible example of my code so you can get an idea of what kind of issue I’m having:
import dash
import os
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
card1 = dbc.Card([
dbc.CardBody([
html.H4("Num1"),
html.P(f"Num1 Description")
])
],
style={'width': '100%',
'text-align': 'center',
'background-color': 'rgba(104,108,252)',
'color':'white'
},
outline=True)
card2 = dbc.Card([
dbc.CardBody([
html.H4("Num2"),
html.P(f"Num2 Description")
])
],
style={'width': '100%',
'text-align': 'center',
'background-color': 'rgba(104,108,252)',
'color':'white'
},
outline=True)
card3 = dbc.Card([
dbc.CardBody([
html.H4("Num3"),
html.P(f"Num3 Description")
])
],
style={'width': '100%',
'text-align': 'center',
'background-color': 'rgb(104,108,252)',
'color':'white'
},
outline=True)
app = dash.Dash(__name__,assets_folder=os.path.join(os.curdir,"assets"))
server = app.server
app.layout = html.Div([
html.Div([
dcc.Graph(id='graph')
],style={'width': '50%','display': 'inline-block','text-align': 'center'}),
html.Div([
dbc.Card(card1),
dbc.Card(card2),
dbc.Card(card3)
],style={'width': '50%','text-align': 'center','display': 'inline-block'})
])
if __name__=='__main__':
app.run_server()
I have played around with lots of different options for the display in the html.div and nothing seems to get the cards aligned properly with the graph.
Can someone help point me in the right direction? Thank you!