Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change order of tbody and tfoot in tables/advanced #729

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mallonbacka
Copy link

The matching MDN article has been updated to state the order that <thead>, <tbody> and <tfoot> should be in, according to the HTML spec. For some more background on this, take a look at mdn/content#32909

Since this table appears in that page, it should be updated to follow the guidance in that page.

I looked at the other tables in this directory, and didn't see any more with a <tfoot>, so I think this is the only one.

@ferdnyc
Copy link

ferdnyc commented Apr 3, 2024

I think this might be a more involved change; it may be better to open an issue.

The larger problem is that html/tables/advanced/spending-record.html (the "starting point" for the lesson) has the SUM row right below the table header:

<table>
<caption>How I chose to spend my money</caption>
<tr>
<th>Purchase</th>
<th>Location</th>
<th>Date</th>
<th>Evaluation</th>
<th>Cost (€)</th>
</tr>
<tr>
<td>SUM</td>
<td>118</td>
</tr>

And the content at https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Advanced#active_learning_adding_table_structure implies outright asserts that you can simply wrap it in <tfoot> to change its position in the table:

  1. First of all, make a local copy of spending-record.html and minimal-table.css in a new folder.
  2. Try opening it in a browser — You'll see that it looks OK, but it could stand to be improved. The "SUM" row that contains a summation of the spent amounts seems to be in the wrong place, and there are some details missing from the code.
  3. Put the obvious headers row inside a <thead> element, the "SUM" row inside a <tfoot> element, and the rest of the content inside a <tbody> element.
  4. Save and refresh, and you'll see that adding the <tfoot> element has caused the "SUM" row to go down to the bottom of the table.

So, the lesson is "teaching" the wrong structure, leading to the bad code in spending-record-finished.html. Changing the end-point alone won't fix the lesson.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants