【问题标题】:Is it possible to put a label inside a form field?是否可以在表单字段中放置标签?
【发布时间】:2015-11-20 07:45:05
【问题描述】:

我将放一张图片,以便您了解我的想法。这不像存在的占位符,除非在框中放置了一些文本。

输入新信息时标签不会消失。

a sample form field design, i don't know if this can be translated to code

【问题讨论】:

  • 如果我理解你,你可以用position: absolute :)

标签: html forms css field


【解决方案1】:

这里是你怎么做的示例

.input-with-label {
  display: inline-block;
  position: relative;
  width: 200px;
}

.input-with-label input {
  padding: 20px 5px 5px 5px;
}

.input-with-label .lbl {
  position: absolute;
  left: 5px;
  top: 5px;
  font-size: 12px;
  opacity: 0.5;
}


<span class="input-with-label">
 <input type="text" />
 <span class="lbl">Contracted Authorites</span>
</span>

http://plnkr.co/xr6uF8EaJwWRL9GN0t1d

【讨论】:

  • 是的,正是我想要发生的事情,谢谢!
猜你喜欢
  • 2015-01-02
  • 2012-04-07
  • 1970-01-01
  • 1970-01-01
  • 2014-01-31
  • 1970-01-01
  • 2018-12-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多