【发布时间】:2018-02-01 18:41:36
【问题描述】:
我有一个具有以下文件结构的 Python 项目
days_on_hand.py
templates\
doh_managers.html
static\
style.css
这是我的 html 模板代码:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel= "stylesheet" type= "text/css" href= "/static/style.css">
<title>{{ title }}</title>
</head>
<body>
<h2>Days Inventory on Hand -- Warehouse</h2>
{{ managers_days }}
</body>
</html>
我也用过以下href
<link rel= "stylesheet" type= "text/css" href= url_for('static', filename='style.css')>
我的输出中没有看到任何 css 格式,这是使用以下内容生成的:
template_vars = {"title": "Days Inventory on Hand -- Warehouse",
"managers_days": df.to_html(index=False)}
html_out = template.render(template_vars)
html_file.write(html_out)
我看到桌子上有双边框,我的css如下,应该折叠边框,H2文本也没有居中。:
h2{
text-align: center;
}
table {
border-collapse: collapse;
}
【问题讨论】:
-
请提供您所看到的和您所期望的。