css - 如何用文本框均匀间隔文本?

标签 css margin spacing

所以我用中间的文本填充空白(参见我的 previous question ),现在我遇到了一个问题,我用 margin-left 和 margin-right 将中间的文本均匀地隔开,但是如果我让我们说 1 而不是 0 它看起来像 1 : 而 0 是正常的 0: 但由于 1 的像素较少,所以看起来不太好,我总是可以这样保留它并希望没有人注意到但我喜欢可能使它看起来尽可能干净。

自己看here

如果不是这里的代码,

.text1 {
  display: inline-block;
  font-size: 4vmin;
  margin-right: -22px;
  margin-left: -4px;
  user-select: none;
  text-align: right;
}

.fill-out {
  outline: none;
  border: 0;
  margin-left: 18px;
  display: inline-block;
}

#box1 {
  width: 13px;
}

#box2 {
  width: 13px;
}

#box3 {
  width: 21px;
}
<div>

  <input class="fill-out" id="box1" type="text" placeholder="00" maxlength="2" />
  <span class="text1">:</span>
  <input class="fill-out" id="box2" type="text" placeholder="00" maxlength="2" />
  <span class="text1">.</span>
  <input class="fill-out" id="box3" type="text" placeholder="000" maxlength="3" />

</div>
```

只输入 2 然后再次运行并输入 1

最佳答案

尝试使用等宽字体。

因为我不认为你会用默认字体得到你想要的结果。

在维基百科上查看差异 wiki .

关于css - 如何用文本框均匀间隔文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55322779/

相关文章:

jquery - HTML,消除框输入 'submit'

jquery - show/hide div 导致内容跳起来

html - 位置 : fixed scrolls too far

css - 如何修复单行文本下的额外边距(仅在 Firefox 中)?

javascript - 使用缩进/间距将元素 append 到 DOM

jQuery:将 <div> 切换到其原始位置,如 CSS 中的 div ID 所述

css - 如何仅在固定高度的内容可用时显示 div?

html - 如何让我的文本框和按钮对齐,看起来像图片?

c - 如何在 C 中生成对数间隔数组

html - 如何删除单词后的 4 像素填充?