【发布时间】:2020-05-11 22:06:48
【问题描述】:
我在我的 Flask 应用程序中使用 bootstrap.min.css 作为样式表,并按以下方式对 Pandas 输出的数据表进行样式设置:
result = pd.DataFrame.from_dict(result, orient='index', columns = [var2use]).to_html(classes='table table-striped table-hover', header = "true", justify = "center")
一切运行良好,样式如期应用。我无法弄清楚的一件事是如何添加.thead-light 或深色样式?
我将这些用作资源
https://getbootstrap.com/docs/4.4/content/tables/
https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.DataFrame.to_html.html
我尝试在此部分添加 classes='table table-striped table-hover' 类似 classes='table table-striped table-hover thead-light' 的内容,但没有出现该样式。
关于如何为我的表格设置样式以使标题在 Flask 应用程序中应用该样式(希望无需编写额外的 .css)有什么建议吗?
【问题讨论】: