Mik*_*e_H 3 css python plotly plotly-dash
我使用 dash 和plotly 构建了一个仪表板,同时使用对 dash 和plotly 的每个教程或文档中使用的外部样式表的引用。
现在我只想定制整个仪表板的字体(包括图中的文本),“没有其他”。我通过以下方式引用外部 css 源:
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
Run Code Online (Sandbox Code Playgroud)
我没有 CSS 经验。我可以覆盖引用源中的相关变量吗?如果可以的话我该怎么做?喜欢:
font-family: "Garamond";
Run Code Online (Sandbox Code Playgroud)
CSS 代码发布在 codepen 上,我也尝试在那里搜索,但没有帮助。
感谢您的帮助!
使用通用 CSS 选择器*。
在您的应用程序目录中创建,或者(我所做的)使用您的自定义 CSS 创建一个 CodePen 并将其首先包含在in/assets/custom.css列表中external_stylesheets
app = dash.Dash(
__name__,
external_stylesheets=external_stylesheets
)
Run Code Online (Sandbox Code Playgroud)
在或 CodePen 中assets/custom.css:
*{
font-family: Garamond;
}
Run Code Online (Sandbox Code Playgroud)
如果您想将其应用于除某些类元素/组件类型之外的所有内容,例如“除了h2and class之外的所有内容myclass”
*:not(h2):not(.myclass){
font-family: Garamond;
}
Run Code Online (Sandbox Code Playgroud)