Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML & CSS Split input form - char by char

I try to split input field to make something like this:

enter image description here

But I'm stuck and I didn't found anything that help me. I find something similar but isn't what I want:

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;
}
<label for="name">Name:</label>
<input type="text" id="name" name="name" maxlength="20" />

The only requirement is to use only HTML and CSS. I would appreciate very much if someone could help me. Thanks!

like image 905
Laurentiu Tibea Avatar asked Sep 06 '25 03:09

Laurentiu Tibea


1 Answers

I got it to look closer with these changes to background, letter-spacing, and padding-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;
}
<label for="name">Name:</label>
<input type="text" id="name" name="name" maxlength="20" />
like image 197
mike.k Avatar answered Sep 07 '25 22:09

mike.k