html tbody下拉列表出现在thead上方

时间:2018-03-09 07:44:27

标签: php html

出于某种原因,我的tbody出现在thead部分之上。无法弄清楚为什么

<table id="myTable" class="table table-inverse table-hover">
    <thead id = "headings" class = "thead-default">
        <tr>
		    <th>Žanro pavadinimas</th>
		</tr>
	</thead>	
	<tbody>
	    <tr>
		    <select name="Zanras">
			    <option value="demo1">demo1</option>
                <option value="demo2">demo2</option>
                <option value="demo3">demo3</option>
		    </select>
		</tr>
	</tbody>
</table>

3 个答案:

答案 0 :(得分:0)

<td>

中缺少<tbody>
<tbody>
        <tr>
            <td>
            <select name="Zanras">
            <?php while($row = $resultc->fetch_assoc()) {  
              echo "<option value=" . $row['Zanro_pavadinimas'] . ">" . $row['Zanro_pavadinimas'] . "</option>";
            }
            ?>
            </select>
            </td>
        </tr>
    </tbody>

答案 1 :(得分:0)

&#13;
&#13;
<table id="myTable" class="table table-inverse table-hover">
    <thead id = "headings" class = "thead-default">
        <tr>
		    <th>Žanro pavadinimas</th>
		</tr>
	</thead>	
	<tbody>
	    <tr>
	    	<td>
		    <select name="Zanras">
			    <option value="demo1">demo1</option>
                <option value="demo2">demo2</option>
                <option value="demo3">demo3</option>
		    </select>
		</td>
		</tr>
	</tbody>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

<td>中必须<tr> 此外,您应该正确缩进代码以提高可读性。

&#13;
&#13;
<table id="myTable" class="table table-inverse table-hover">
  <thead id="headings" class="thead-default">
    <tr>
      <th>Žanro pavadinimas</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><select name="Zanras">
        <option value="demo1">demo1</option>
        <option value="demo2">demo2</option>
        <option value="demo3">demo3</option>
      </select></td>
    </tr>
  </tbody>
</table>
&#13;
&#13;
&#13;