有没有可能将占位符在父输入框之外垂直居中对齐?在下面的代码中,似乎没有办法使占位符出现在输入框的垂直中心。我已经尝试了我能想到或在线找到的所有CSS属性和解决方法,但输入框和占位符上不同的字体大小似乎使它在至少在Webkit浏览器中无法实现。
编辑:左边是问题,右边是期望的外观:
编辑:左边是问题,右边是期望的外观:
![enter image description here](https://istack.dev59.com/zZ8au.webp)
input {
font-size: 22px;
text-align: center;
font-weight: bold;
line-height: 44px;
}
input::-webkit-input-placeholder {
font-size: 9px;
text-transform: uppercase;
color: #AAA;
}
<input type='text' placeholder='enter some text' />