小编Ale*_*dro的帖子

Python dash Div整页背景图片

抱歉,我对 dash、css、html 编码很陌生。

我正在 Python 上使用 Dash,我想要一个带有图像的简单的整页背景。

我正在使用这个CSS:https ://codepen.io/chriddyp/pen/bWLwgP.css

我尝试使用不同的CSS(https://necolas.github.io/normalize.css/8.0.1/normalize.css),因为我读到这是一个边距问题,但它不起作用

我读过很多关于这个问题的讨论,但我无法根据我的目的修复它

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

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


app.title = "Q"


colors = {'background': '#ffffff',
          'bg_home': '#666666',
          'text': '#ffa500',
          'background_plot': '#cccccc',
          'text_plot': '#000000'}

app.config['suppress_callback_exceptions']=True
image   = 'url(https://c.wallhere.com/photos/a1/fc/1920x1080_px_Albert_Einstein_Formula_mathematics_physics_science_Special_Relativity-549404.jpg!d)'

app.layout = html.Div(

                className='row',
                  style={
                          'verticalAlign':'middle',
                          'textAlign': 'center',
                          'background-image':image,


                            },

                  children= [
                           html.Div(
                                   id='Username',
                                    style={'textAlign': 'center',
                                           'verticalAlign':'middle',
                                           },
                                    children= [         
                                            html.H3('Login',
                                                        style={'textAlign': 'center',
                                                           'color':'orange',
                                                           'fontWeight': 'bold',
                                                               },                                                       
                                                    ),
                                            html.Div(             
                                                    className='row', 
                                                    children=[
                                                         dcc.Input(id = 'user',
                                                                   style={'margin-top':20},
                                                                  type='text',
                                                                  placeholder='Username'
                                                                  ) …
Run Code Online (Sandbox Code Playgroud)

css python plotly-dash

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

plotly-dash ×1

python ×1