Sometimes, we want to add an HTML text input field with currency symbol.
In this article, we’ll look at how to add an HTML text input field with currency symbol.
How to add an HTML text input field with currency symbol?
To add an HTML text input field with currency symbol, we add the currency symbol before the input.
For instance, we write
<span class="currencyinput">$<input type="text" name="currency" /></span>
to add a span with the dollar sign before the input.
Then we write
.currencyinput {
border: 1px inset #ccc;
}
.currencyinput input {
border: 0;
}
to add a border around the span.
And we remove the border from the input to make the dollar sign and input look like they’re in the same input box.
Conclusion
To add an HTML text input field with currency symbol, we add the currency symbol before the input.