下面的字段从用户输入中检索每小时的工资率。如何在用户输入小时工资率的输入字段内(或之前)显示“$”符号?
<tr>
<td>Hourly Pay Rate</td>
<td><input type = "number" name = "HPR" min="0" step="0.01" required></td>
</tr>
答案 0 :(得分:4)
.dollar{
display:inline-block;
position: relative;
}
.dollar input{
padding-left:15px;
}
.dollar:before {
position: absolute;
content:"$";
left:5px;
top:2px;
}
<div class="dollar"><input type="number"></div>
答案 1 :(得分:1)
.dollar::before {
content: "$";
padding: 0 5px;
text-align: center;
}
<div class="dollar">
<input type ="text">
</div>
答案 2 :(得分:0)
不确定你要求的是什么:
第一个将在输入类型
之前放置一个&#34; $&#34;符号<tr>
<td>Hourly Pay Rate</td>
<td>$<input type = "number" name = "HPR" min="0" step="0.01" required></td>
</tr>
第二个将放置&#34; $&#34;在输入类型中,一旦用户开始输入,它就会消失。
<tr>
<td>Hourly Pay Rate</td>
<td><input type = "number" placeholder="$" name = "HPR" min="0" step="0.01" required></td>
</tr>
答案 3 :(得分:0)
在输入框之前,您可以尝试:
<td>Hourly Pay Rate($):</td>
<td><input type = "number" name = "HPR" min="0" step="0.01" required></td>