doflamingo doflamingo -4 years ago 80
CSS Question

CSS - how to fix first <td> in table on top if the second <td> has multiline?

In this code below you will see the "Upload image" text in first td has move down (because of multiline input in next td) . But I want this text to be fixed at top.
How can I do?



<table>
<tr>
<td> Upload Image </td>
<td> <input type="file" name="images[]" /> <br>
<input type="file" name="images[]" /> <br>
<input type="file" name="images[]" /> <br>
<input type="file" name="images[]" /> <br>
</td>
</tr>
</table>




Answer Source

Use vertical-align: top to the td with text - see demo below:

table tr > td:first-child {
  vertical-align: top;
}
<table>
  <tr>
    <td>Upload Image</td>
    <td>
      <input type="file" name="images[]" />
      <br>
      <input type="file" name="images[]" />
      <br>
      <input type="file" name="images[]" />
      <br>
      <input type="file" name="images[]" />
      <br>
    </td>
  </tr>
</table>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download