I have an HTML input element of type select. The height of the element is 28px. Without modifying the element with CSS, the text inside gets automatically vertically-aligned in all browsers except for IE8. In IE8 the select’s text is in the bottom left corner of the element.
Does anyone know how to vertically-align the text inside an HTML select element?
Without your
htmlit is hard to know exactly what you are styling. It sounds like you are using something like<input type="select" />but that isn’t actually valid html.However, to vertically align the text in the middle you need to set the
line-heightto be the same figure as yourheight.So in this case you would need to set
line-height: 28px;to matchheight: 28px;.For your
htmlI would recommend either using:<input type="text" />if you are looking for a standard text inputor
If you are looking for a drop down selection: