Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I print a dollar symbol inside(or before) the input box?

Tags:

html

The field below retrieves hourly pay rate from user input. How can I display a "$" sign inside (or before) the input field where the user types in the hourly pay rate?

<tr>
<td>Hourly Pay Rate</td>
<td><input type = "number" name = "HPR" min="0" step="0.01"  required></td>
</tr>
like image 494
javaprogrammer Avatar asked Dec 14 '22 09:12

javaprogrammer


1 Answers

.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>
like image 122
Cris Avatar answered Mar 08 '23 12:03

Cris