0

这是我的代码,当我运行它时,我的错误如下。

app.layout = html.Div(children=[ 
                                # TASK1: Add title to the dashboard
                                # Enter your code below. Make sure you have correct formatting.
    html.H1('US Domestic Airline Flights Performance' style={'textAlign': 'center', 'color': '#503D36', 'font-size': 24 })
                                # REVIEW2: Dropdown creation
                                # Create an outer division 
                                html.Div([
                                    # Add an division
                                    html.Div([
                                        # Create an division for adding dropdown helper text for report type
                                        html.Div(
                                            [
                                            html.H2('Report Type:', style={'margin-right': '2em'}),
                                            ]
                                        ),
                                        # TASK2: Add a dropdown
                                        # Enter your code below. Make sure you have correct formatting.
                                          dcc.Dropdown(id='input-type', 
                   options=[
                           {'label': 'Yearly Airline Performance Report', 'value': 'OPT1'},
                           {'label': 'Yearly Airline Delay Report', 'value': 'OPT2'}
                           ],
                  placeholder='Select a report type',
                  style={'width': '80%', 'padding': '3px', 'font-size': '20px', 'textAlign': 'center' }})
                                    # Place them next to each other using the division style
                                    ], style={'display':'flex'}),

html.H1() 标签上的错误信息

我得到了语法错误,我通过更好地构建代码来修复最初的 H1 错误,但后来我尝试了,在代码的 flex 部分的样式附近出现了一个不同的语法错误,请帮忙。

4

1 回答 1

0

我认为您在参数html.H1之前的标签中缺少逗号style

html.H1('US Domestic Airline Flights Performance', style={'textAlign': 'center', 'color': '#503D36', 'font-size': 24 })
于 2022-01-24T17:39:55.630 回答