gpt4 book ai didi

html - 如何用占位符居中标签?

转载 作者:太空宇宙 更新时间:2023-11-04 11:25:54 25 4
gpt4 key购买 nike

我制作了一个简单的表单应用程序。我几乎可以完成 90%。但我有一个问题。在我的应用程序中,我有标签,在它前面我有文本字段。我需要标签文本应该居中或与占位符相同的基础,enter image description here

。我尝试给 top:5px ma​​rgin-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;
}

标签将与占位符对齐。

Fiddle

关于html - 如何用占位符居中标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32389771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com