这不是一个关于 div 垂直居中的问题,而是显示隐藏文件输入上的标签垂直对齐?
https://jsfiddle.net/pbv07uxm/
table {
font-family: sans-serif;
}
.submitButton {
height: 44px;
width: 104px;
display: block;
background-color: #002044;
color: white;
}
.hide {
display: none;
}
.fileLabel {}
#photoButton {
text-align: center;
}
<table>
<tr>
<td>
<input class="submitButton" type="submit" value="Back">
</td>
<td>
<input class="submitButton" type="submit" value="End">
</td>
<td>
<div id="photoButton">
<input type="file" name="photo" id="photo" class="hide" accept="image/*" capture="camera" />
<label for="photo" class="submitButton fileLabel">Take photo</label>
</div>
</td>
</tr>
</table>
您可以使用flex
. 将这些样式添加到
.fileLabel {
display:flex;
align-items:center;
justify-content:center;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句