如何在表头下放置水平规则?

时间:2013-07-21 18:22:28

标签: html html5 html-table

我正在尝试在表标题<hr />下放置一个水平规则<th>,但几乎没有成功。这可能没有黑客吗?

以下是我正在使用的HTML以及我尝试过的内容

<div id="epd" class="editProfileDiv">    
    <form>
        <table align="center">
            <th> Profile Information </th>
            <tr> 
                 <hr />                  
            </tr>
            <tr>
                <td>Name: </td>        
                <td><input id="name" name="name" value="<?php echo $_SESSION['name'];?>" placeholder=" Jon Doe" type="text" class=""></td>
            </tr> 

该代码在浏览器中显示如下

----<hr/> is here----
 Profile Information
 Name:  <text input>

然后我尝试了这个

<th> Profile Information </th>
<hr />                  
<tr><td> something here </td></tr>

结果完全相同,<hr/>位于表格标题

之上

这......

<tr> 
  <td> <hr /> </td> // If I only use one it only spans half the width of the table
  <td> <hr /> </td>                  
</tr>

<hr/>置于正确的位置,但它们之间显然存在差距,我想要的东西。

现在我知道我可以使用表格标题,并使用常规段落或任何文本,然后根据需要设置样式。在这一点上,它只是校长,因为这是在困扰我。再次,问题是:这可能吗?

1 个答案:

答案 0 :(得分:7)

试试这个:

<tr> 
  <td colspan="2"> <hr /> </td>      
</tr>