我在弄清楚将 dash_core_components.Input
文本字段置于页面中间所需的样式参数方面遇到了很多困难。
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
text_input_style = {'justify-content': 'center', 'align-items': 'center'}
bucket_select = html.Div([
html.Label('S3 bucket:'),
dcc.Input(id='bucket_name', placeholder='Enter input here...',
value=None, type='text',
style={'width': '10%', 'textAlign': 'center'}),
html.Div(id='bucket_out')
], style=text_input_style)
app = dash.Dash(__name__)
app.layout = html.Div(bucket_select)
app.run_server(port=5555)
到目前为止我已经尝试过:
'justify-content': 'center'
'align-items': 'center'
'显示':'flex'
'padding-left':'45%'
我尝试在文档中搜索 dcc.Input
,但找不到任何 style
信息。
最佳答案
This is where您可以找到 dcc.Input 的各种 Prop 。您可以将包含的 div
设置为具有 display='flex'
和 justifyContent='center'
。示例:
html.Div(
children=[dcc.Input()], # fill out your Input however you need
style=dict(display='flex', justifyContent='center')
)
关于python - Plotly Dash 中心 dcc.输入文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57367419/