Welcome to WebmasterWorld Guest from 3.93.74.227

Forum Moderators: open

Message Too Old, No Replies

Table without structural errors

     
11:50 am on Feb 26, 2018 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Jan 11, 2015
posts:95
votes: 1


Using XHTML 1.0 Transitional or HTML5 what is the correct way to create a table with a header between these examples?

1)

<table>
<tr><th></th><th></th></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>

2)

<table>
<tbody>
<tr><th></th><th></th></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</tbody>
</table>

3)

<table>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>

4)

<table>
<thead>
<tr><th></th><th></th><tr>
</thead>
<tbody>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</tbody>
</table>

6)

<table>
<tbody>
<tr><td><b></b></td><td><b></b></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
</tbody>
</table>
2:30 pm on Feb 26, 2018 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4559
votes: 363


<th is part of the <thead group which is optional but since you asked about a table with a header, it should have <thead tags enclosing the <th elements.

<tbody is an optional tag, if you use <tbody, it comes after the table header, so the structure in your example #4 is correct.

Any of the structures shown will function, but for formatting the appearance, the optional tags allow better element definition in your CSS.
7:13 pm on Feb 26, 2018 (gmt 0)

Senior Member from GB 

joined:Oct 2, 2003
posts: 1019
votes: 39


Hi there analis,
This is the basic structure...



<!DOCTYPE HTML>
<html lang="en">
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">

<title>untitled document</title>

</head>
<body>

<table>
<caption>caption</caption>
<thead>
<tr>
<th>header</th>
<th>header</th>
</tr>
</thead>
<tfoot>
<tr>
<td>footer</td>
<td>footer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>body</td>
<td>body</td>
</tr>
</tbody>
</table>

</body>
</html>




birdbrain
4:02 pm on Feb 27, 2018 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Jan 11, 2015
posts:95
votes: 1


I entered the discussion in seo, I meant correct for the google algorithm.

Wikipedia EN uses this type of table:

<table>
<tr><th></th><th></th></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>

Wikipedia IT uses this type of table:

<table>
<tbody>
<tr><th></th><th></th></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</tbody>
</table>
5:36 pm on Feb 27, 2018 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4559
votes: 363


A table is a table, its structure offers options, but the content of any table is far more important to SEO than the html structure.

I apologize for misunderstanding the purpose of your question, it was moved to the HTML forum because your question asked which structure was correct. You are free to start a discussion in the Google SEO forums on the relation between SEO and HTML in general, that's where that kind of discussion would find traction.

My own opinion is that I see some very poorly structured html ranking quite nicely in Google. I am pretty sure that Wikipedia (EN or IT) is not highly ranked due to its html structure, but rather for the immense amount of content they offer. Google isn't so much concerned about validated html so long as it is functional. Their own sites often have minor errors.