[英]align input text vertically
I have a input text element whose height is adjusted and the text is aligned to right.我有一个输入文本元素,其高度已调整且文本右对齐。
How can I align it vertically (on baseline)?我怎样才能垂直对齐它(在基线上)?
I tried adding some padding to the input elememt at the top and it works.我尝试在顶部的输入元素中添加一些填充,它起作用了。 However, I would like to know if there is any property that can be set to align it vertically.
但是,我想知道是否有任何属性可以设置为垂直对齐。
I also tried to set display: inline-block and vertical-align: text-bottom but didn't work.我还尝试设置 display: inline-block 和 vertical-align: text-bottom 但没有用。
This is my input element:这是我的输入元素:
<input id="display" type="text" />
Here is the css code:这是 css 代码:
form #display {
height: 10 %;
width: 100 %;
border: none;
background-color: rgb(12, 37, 30);
color: white;
text-align: right;
padding-right: 20px;
font-family: 'Gotham Rounded Light', sans-serif;
font-size: 12px;
}
You can try a couple of solution,你可以尝试几个解决方案,
vertical-align: middle
another one另一个
input[type=text] {
height: 15px;
line-height: 15px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.