开发者

What I'm doing wrong in display this table?

Probably this is a stupid thing, but I don't see it. What is the problem?

<html>
<body>
<form action="search" method="get">
    <input>
    <input name="action" value="search" type="submit">
</form>

<table border="1">
    <thead>
    <th>
        <td>Name</td>

    </th>
    </thead>
    <tbody>

    <tr>
        <td>Smith        </td>

    </tr>

    <tr>
        <td>Smith2        </td>
        </tr>

开发者_开发技巧    </tbody>
</table>
</body>
</html>

The "Smiths" are not displayed under the "Name" cell.


th tags are "table headers", you need to place them inside tr's, "table rows".

<tr>
    <th>Name</th>
</tr>

or

<tr>
    <td>Name</td>
</tr>


<th>
  <td>Name</td>
</th>

Replace with:

<tr>
  <th>Name</th>
</tr>


Here are great and fresh post about table explain everything http://woork.blogspot.com/2009/09/rediscovering-html-tables.html must see :)


Th's are the root of your problem. Placing them like so will give you one column like your'e expecting.

<tr>
    <th>Name</th>
</tr>


You don't need the < td >< /td > inside the < th > and wrap it in a < tr >, you need:

<tr>
    <th>
        Name
    </th>
</tr>


Do this:

<thead>

<tr>
<th>
 Name
</th>
</tr>

</thead>

TH is just like any column () but with different default properties (bold text, center aligned text). So it has to be nested within a row ( )


Fix your THead element:

<thead>
  <tr>
    <th>Name</th>
  </tr>
</thead>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜