HTML 文本字段的标签显示为三行

标签 html css label textfield htmltext

我已经创建了一个输入文本字段并使用 html 为其提供了一个标签,但我没有在一行中显示标签,而是面临标签以三行显示的问题。

label {
  display: inline-block;
  position: relative;
  width: 5px;
  top: 0px;
  left: -193px;
  color: #999;
  font-family: 'Helvetica', sans-serif;
  font-size: 16px;
  font-weight: lighter;
  z-index: 1;
  transition: all 0.2s ease-in;
}
<input type="text" name="verficationcode" required autocomplete="off">
<label for="verficationcode">Enter code here</label>

Image

最佳答案

注释掉或调整width属性:

label {
    display: inline-block;
    position: relative;
    /*width: 5px;*/
    top: 0px; 
    /*left: -193px;*/
    color: #999;
    font-family: 'Helvetica', sans-serif;
    font-size: 16px;
    font-weight: lighter;
    z-index: 1;
    transition: all 0.2s ease-in;
}
<input type="text" name="verficationcode" required autocomplete="off">
<label for="verficationcode">Enter code here</label>

关于HTML 文本字段的标签显示为三行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47525493/

相关文章:

html - 转到移动设备时,Bootstrap 横幅不会调整大小

javascript - 如何使用 javascript 以编程方式设置多选框元素的值(复数)?

javascript - 弹出窗口中父实体的选择器

python - 如何在Python Tkinter中管理带边框标签内的间距?

string - 如何设置标签 Xamarin 表单的最大高度?

php - 父级 : Received shutdown signal -- Shutting down the server

javascript - 垫自动完成功能未正确过滤 Angular

html - 调整大小时如何在屏幕上保持绝对定位元素

jquery - 使用 jQuery 幻灯片时出现对齐问题

.net - WinForms 中的右对齐标签