HTML 和 CSS 拆分输入表单 - 逐个字符

Lau*_*bea 3 html css split input

我尝试拆分输入字段以制作如下内容:

在此处输入图片说明

但是我被卡住了,我没有找到任何可以帮助我的东西。我找到了类似的东西,但不是我想要的:

input[type="text"] {
  border: none;
  width: 400px;
  background: repeating-linear-gradient(90deg, dimgrey 0, dimgrey 1ch, transparent 0, transparent 1.5ch) 0 100%/52% 2px no-repeat;
  color: dimgrey;
  font-family: monospace;
  letter-spacing: .5ch;
}

input:focus {
  outline: none;
  color: dodgerblue;
}
Run Code Online (Sandbox Code Playgroud)
<label for="name">Name:</label>
<input type="text" id="name" name="name" maxlength="20" />
Run Code Online (Sandbox Code Playgroud)

唯一的要求是仅使用 HTML 和 CSS。如果有人能帮助我,我将不胜感激。谢谢!

mik*_*e.k 5

我得到了它的这些变化看近backgroundletter-spacingpadding-left

input[type="text"] {
  border: solid 1px dimgrey;
  width: 400px;
  background: repeating-linear-gradient(90deg, #ffffff 0px, #ffffff 19px, #000000 20px);
  color: dimgrey;
  font-family: monospace;
  letter-spacing: 1.75ch;
  padding-left: 0.8ch;
}

input:focus {
  outline: none;
  color: dodgerblue;
}
Run Code Online (Sandbox Code Playgroud)
<label for="name">Name:</label>
<input type="text" id="name" name="name" maxlength="20" />
Run Code Online (Sandbox Code Playgroud)