【问题标题】:How to change the placeholder font color for dcc.Input, using Plotly's Dash如何使用 Plotly 的 Dash 更改 dcc.Input 的占位符字体颜色
【发布时间】:2021-04-04 21:29:06
【问题描述】:

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

我已经搜索了文档here,但没有找到解决方案。

谢谢,

这是我尝试过的......

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

                     }
              )

【问题讨论】:

    标签: python plotly-dash plotly-python


    【解决方案1】:

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

    要通过 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 文档的链接,展示了如何添加一个:Adding Your Own CSS

    【讨论】:

    • 感谢您的提示!您可以将您的答案标记为“已接受的答案”,以便关闭问题。
    猜你喜欢
    • 2020-07-21
    • 2016-07-26
    • 1970-01-01
    • 1970-01-01
    • 2019-12-13
    • 2022-01-15
    • 2018-09-19
    • 2020-08-22
    • 2012-04-12
    相关资源
    最近更新 更多