【发布时间】:2021-09-19 14:37:27
【问题描述】:
对不起,如果这有点含糊。我一直在尝试使用构建一个简单的表。我一直在关注this tutorial,但是当我运行该站点时,css 似乎不起作用。某些部分可以,例如行着色,但仅此而已。有点奇怪,希望你们中的一个可以帮助我。
HTML:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Mankey Activity</title>
<link rel="stylesheet" href="/static/styles.css"/>
</head>
<body>
<table class="table">
<tr class="table__header">
{% for header in headings %}
<th class="table__cell>">{{ header }}</th>
{% endfor %}
</tr>
{% for row in data %}
<tr class="table__row">
{% for cell in row %}
<td class="table__cell">{{ cell }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</body>
</html>
CSS:
.table {
border-spacing: 0;
border-radius: 4;
margin: 1rem;
background-color: #f5f5f5;
}
.table__row:nth-child(even) {
background-color: #e5e5e5;
}
.table__header {
text-align: left;
}
.table__cell {
padding: 8px;
text-align: left;
}
网站:
对不起,如果我是愚蠢的。
【问题讨论】: