Bjorn
Bjorn

Reputation: 91

Letter-spacing input even

I am making a html form with a inputfield. If I use letters and numbers the letter-spacing is incorrect. How do I make sure that the letter-spacing is always good?

Good:

Good

Bad (letter-spacing): Bad

input{
  margin: auto;
  display: block;
  background: transparent;
  height: 76px;
  border: none;
  text-align: left;
  font-family: "Avenir", sans-serif !important;
  font-weight: 500;
  font-size: 30px;
  width: 600px;
  letter-spacing: 49px;
  padding-left: 30px;
}

<div class="coupon">
  <h3 class="widget-title bluetext">Coupon</h3>
  <div class="couponwrap">
    <input type="text" id="ticket-number" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"  maxlength="8" minlength="8">
    <div class="cursor-hide"></div>
  </div>
</div>

How can i fix this?

Upvotes: 1

Views: 2170

Answers (1)

superUntitled
superUntitled

Reputation: 22527

As was stated in the comments, you should use a mono-space font like Courier. Avenir's characters (and other non-mono-spaced characters) have unique horizontal space per character.

If Avenir is absolutely necessary, you could use multiple inputs with javascript auto incrementing on input.

Upvotes: 0

Related Questions