Sorry for my poor English. I have a span (like $) and an input, when user inputs something, the span and input should always stay centered horizontally. I want it looks like the row 1 in the code below. But in fact I can just code it like row 2.
I want a solution, it will be better to be without js. I've read about this article(HTML text input field with currency symbol) but it doesn't solve my problem for it doesn't center anything.
.main{
  display:flex;
  align-items:center;
  justify-content:center;
}
.this-should-be-input{
  font-size:36px;
}
.the-input{
  border:none;
  text-align:center;
  
}<div class="main">
    <span style="font-size:24px;">$</span>
    <div class="this-should-be-input">
        12345
    </div>
</div>
<div class="main">
    <span style="font-size:24px;">$</span>
    <input class="this-should-be-input the-input" value="12345"/>     
</div> 
     
    