我制作了一个简单的表单应用程序。我几乎可以完成 90%。但我有一个问题。在我的应用程序中,我有标签,在它前面我有文本字段。我需要标签文本应该居中或与占位符相同的基础,
。我尝试给 top:5px margin-top:5px 但没有任何效果。换句话说 要求标签应与文本字段的占位符处于同一级别。
这是我的代码 http://codepen.io/anon/pen/NGPvge
.wrapper{
padding-top:3em;
}
.label_title div {
text-align: center;
margin-top: 1em;
position: relative;
}
最佳答案
在
中进行这些更改.label_title div {
text-align: center;
margin-top: 1em; <<<---Remove this
line-height: 50px; <<<---Add this
position: relative;
}
标签将与占位符对齐。
关于html - 如何用占位符居中标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32389771/