我一辈子都想不出如何在 html5 日期输入中将文本居中。如您所见,我可以更改文本的颜色但不能将其居中。我也在 css 中尝试了很多东西
input.element.text{text-align:center;/* dont work here */color:green;line-height: 30px;}/* change color but not align*/
input[type=date]{
line-height: 46px;
height: 30px;
width:300px;
text-align: center;/* dont work here */
text-align-last: center;
color:red;/* used to test */
}
input[type=text]{ color:blue;/* used to test */
text-align: center;/* dont work here */
text-align-last: center;
}
<input type="date" name="dob" class="element" size="" maxlength="15" value="" type="text" placeholder="" required>
最佳答案
.bigbox{
height:40px;
line-height:40px;
padding:0 5px;
}
来源:How to vertically align text in input type=“text”? [duplicate]
关于html - 在 html5 日期输入中居中文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52105139/