作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下代码,现在我一直在研究如何将标签放在文本框内/旁边,以提供 1 个元素的感知:
HTML
<div style="position: relative; float: left; margin-left: 12px;">
<input type="text" class="theInput" />
<label class="theLabel">$ |</label>
</div>
CSS
.theInput {
-webkit-appearance: none;
-moz-appearance: none;
text-overflow: ellipsis;
color: #333333;
outline: none;
border: 1px solid #E4EBED;
border-radius: 3px;
width: 70px;
height: 32px;
line-height: 25px;
font-size: 16px;
vertical-align: middle;
background-color: #fff;
padding-left:45px;
}
.theLabel {
position:absolute;
z-index:999;
-webkit-appearance: none;
-moz-appearance: none;
color: #333333;
outline: none;
width: 34px;
height: 32px;
line-height: 30px;
font-size: 20px;
background-color: #fff;
margin-left:-106px;
font-weight: bold;
cursor:default;
}
这是所需的:final result
最佳答案
这里的例子:
你应该像这样使用 label 标签:
<label>Label Name: <input type="text" class="theInput"></label>
关于html - 我需要将我创建的这个标签放在/或紧挨着文本框。有什么想法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33518186/
我是一名优秀的程序员,十分优秀!