Reputation: 185
This html code "Date Accessed" is in one column (at the top as a header), while the actual dates are in another column, but they're all supposed to be in one column. I can't figure out why.
<!DOCTYPE html>
{% load static %}
<html>
<head>
<meta charset="utf-8">
<title>Django Level Two</title>
<link rel="stylesheet" href="{% static "css/mystyle.css" %}"/>
</head>
<body>
<h1> Hi welcome to Django Level Two <h1>
<h2> Here are your access records:<h2>
<div class="djangtwo">
{% if access_records %}
<table>
<thead>
<th>Site Name</th>
<th>Date Accessed</th>
</thead>
{% for acc in access_records %}
</tr>
<td>{{acc.name}}<td>
<td>{{acc.date}}<td>
<tr>
{% endfor %}
</table>
{% else %}
<p>NO ACCESS RECORDS </p>
{% endif %}
</div>
</body>
</html>
the problem is not in the .css file but here it is anyways
h1{
color: red;
}
table, th, td {
border: 2px solid black
}
any help would be greatly appreciated-thnx
Upvotes: 0
Views: 37
Reputation: 99
Your <tr>
start/end tags are the wrong way round, they should look like this. Also added correct end tags for <td>
elements.
<tr>
<td>{{acc.name}}</td>
<td>{{acc.date}}</td>
</tr>
Upvotes: 2