HTML - 表格行垂直对齐问题

标签 html css

我似乎无法让这些元素垂直对齐(参见随附的屏幕截图) Expectation vs Reality... (那个黑色 Blob 是一个数字字段)

enter image description here

我已经尝试将 CSS 样式应用于所有内容 - vertical-align: middle;垂直对齐:文本顶部;垂直对齐:居中; 就一切而言,我的意思是,表单、文本字段、行……似乎没有任何效果。

我需要一些专家建议。 谢谢 下面的代码

 <tr id="Row4">
  <td width="421" align="right">
        <form name="form7" id="form7" action="sendSMSCommand.php" method = "post" onsubmit="return confirm('Are you sure you want to send an SMS command?');"  >
         <input type="number"  class="textbox" vertical-align="middle" min ="0" max = "1440" name="timeField7" id="timeField7">
         <input type="image" name="imageField7" id="imageField7" onmouseup= "SendCMD(7)" onmousedown="changeImage(7)" src="img/ButtonBlueb.png" width="58" height="58" value="">
         <img src="img/on.png" alt="" width="55" height="55" id="IO7" name="IO7"/>
   </form>   
</td>
</tr>

最佳答案

试试这个 css 来自 http://jsbin.com/zepilidena/1/edit?html,css,output

td{
    height: 160px; /*can be anything*/
    width: 160px; /*can be anything*/
    position: relative;
}
.textbox, #imageField7{
    max-height: 100%;  
    max-width: 100%; 
    width: auto;
    height: auto;
    position: absolute;  
    top: 0;  
    bottom: 0;  
    left: 0;  
    right: 0;  
    margin: auto;
}

关于HTML - 表格行垂直对齐问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35643605/

相关文章:

javascript - 将鼠标悬停在文本上时更改带有文本的指针

javascript - 使用 css 转换 div

css - CSS3 box-shadow :inset do only one or two sides? 可以像 border-top 一样吗?

html - 背景渐变/图像上的对 Angular 线/纹理叠加

JavaScript/jQuery 检测 div 是否包含不包括子项的文本

PHP 无法在未经验证的情况下以数据库形式发送数据

javascript - 如何使用 Aurelia 将换行符呈现为 <br> 标记

html - 当有一些其他内容 float 时,如何让 html 表格单元格中的内容居中?

javascript - 有没有办法可以将 $set 与条件一起使用?

html - 如何在 capybara 中向键发送向下箭头