Reputation: 1796
I need to do have in HTML text show up before and after an input field, on the same line. The prefix and suffix are added at run time, and may or may not be there. I have tried and and combinations there of. Here is what I have now:
Here is what I am trying to achieve (remembering that the values will sometimes not be there, so I would like the text input recover that space when they are not there:
Here is my current code (I did cut out some class defs to make it more readable):
<div>
<div>Prefix and Suffix</div>
<div class="row">
<span style="display:inline-block">Test<input type="text" class="input">Dollars</span>
</div>
</div>
I would prefer a solution that does not use tables (just div) but if that is the only way to do it, so be it.
Upvotes: 1
Views: 8380
Reputation: 661
using flex seems to work just fine for me. Might be worth a try.
<div style="display:flex;">
<div>Test </div>
<input type="text">
<div> Dollars</div>
</div>
Upvotes: 1