简体   繁体   English

字母间距输入

[英]Letter-spacing input even

I am making a html form with a inputfield. 我正在用inputfield创建一个html表单。 If I use letters and numbers the letter-spacing is incorrect. 如果我使用字母和数字,则字母间距不正确。 How do I make sure that the letter-spacing is always good? 如何确保字母间距始终良好?

Good: 好:

好

Bad (letter-spacing): 错误(字母间隔): 坏

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? 我怎样才能解决这个问题?

As was stated in the comments, you should use a mono-space font like Courier. 如评论中所述,您应该使用像Courier这样的等宽字体。 Avenir's characters (and other non-mono-spaced characters) have unique horizontal space per character. Avenir的字符(和其他非等宽字符)每个字符具有唯一的水平空间。

If Avenir is absolutely necessary, you could use multiple inputs with javascript auto incrementing on input. 如果绝对需要Avenir,则可以使用多个输入,并在输入时使用javascript自动递增。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM