首页 > 解决方案 > 类型错误:ID 为“Br(None)”的 `dash_html_components.P` 组件(版本 1.0.3)检测到 `children` 以外的道具的组件

问题描述

我是 Dash 和 HTML/CSS 的新手,我发现<br>在 Dash 中创建标签时存在问题。

我正在尝试使用其中创建一个带有文本中断的段落,html.Br()但错误一直告诉我我没有将它包裹起来,children即使我有。这是我的代码:

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

## CSS color codes ##
colors = {
'background': '#87CEFA',
'text': '#000000'
}


app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

## Creating HTML style ##
app.layout = html.Div(children=[
    html.H1(children='First Dash Server',
            style={
            'textAlign': 'center',
            'color': colors['text']
    }
    ),


    html.Div(children= 'Dash: A web application framework for Python.',
             style={
             'textAlign': 'center',
             'color': colors['text']}
    ),   


    html.Div(children=[
        html.H2('Information on server'),
        html.P('This is a Dash server and requirements are:'
                'X')]
    ),

   html.Div(children=[
    html.H2(('Introduction to the project'),
    html.P('In the process of idea building for this coursework I decided to host my visualisations on a dashboard using the Dash library in python.',
           html.Br(),
           'I started with a simple line graph using matplotlib'))]
),

这可能在 HTML 中丢失了一些东西,但我不明白出了什么问题。

任何帮助将不胜感激。

标签: pythonhtmlcssdashboard

解决方案


推荐阅读