如何使用 Plotly 的 Dash 更改 dcc.Input 的占位符字体颜色

How to change the placeholder font color for dcc.Input, using Plotly's Dash

我不知道如何更改 dcc.Input 的占位符字体颜色,通过 Plotly 的 Dash。对于此示例,我想将占位符字体颜色更改为蓝色。

我已搜索文档 here,但未能找到解决方案。

谢谢,

这是我试过的...

    dcc.Input(
               placeholder='Name...',
               type='text',
               value='',
               style={'display': 'inline-block',
                      'background-color': 'white',
                      'border-color': 'white',
                      'color': 'red',
                      'place-holder-color':'blue'

                     }
              )

我能够在其他论坛上获得帮助,但在这里回答我自己的问题以防其他人遇到这个问题。

要通过 Plotly 的 Dash 更改 dcc.Input 的占位符字体颜色,您需要将这行代码添加到您的项目 CSS 文件中..

::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
  color: blue; #replace blue with whatever color your want your font to be 
  opacity: 1; /* Firefox */
}

以防万一,像我一样,你的项目甚至还没有 CSS 文件,这里是 Dash 文档的 link,展示了如何添加一个文件:Adding Your Own CSS