0

I am using an input in one of my projects and I'm making a dotted line on the bottom. Ideally, I would like to have about 5 dots about 10px wide each. Kind of like the example below:
________ ________ _______ ______ _____.

This is the code that I have so far :

input {
  border-bottom: 3px tomato dotted;
}
<input type="text" numbers-only>
tacoshy
  • 10,642
  • 5
  • 17
  • 34
Aidan Young
  • 102
  • 2
  • 6

3 Answers3

3

Use gradient

input {
  border-bottom: 3px solid tomato;
  border-bottom:none;
  background:repeating-linear-gradient(to right,tomato 0 10px,transparent 0 15px) bottom/100% 3px no-repeat;
}
<input type="text" numbers-only/>
Temani Afif
  • 245,468
  • 26
  • 309
  • 415
0

Try using a background with linear-gradient to get 5 lines like this:

input {
  border-bottom: none;
  background-image: linear-gradient(to right, black 90%, white 0%);
  background-position: bottom;
  background-size: 40px 1px;
  background-repeat: repeat-x;
}
<input type="text" numbers-only />
0

I don't think there's a way to change the default styling of the dotted border type.

This answer uses the background-image property with a gradient to simulate a border.

You can use this trick on an element behind your input like the following example.

#my-input {
  /* Keep form compatability by
     using an inline display type */
  display: inline-block;
  
  /* Make some space at the bottom
     for the gradient to show under
     the input */
  padding-bottom: 2px;
  
  background-image: linear-gradient(to right, tomato 50%, transparent 0%);
  background-position: bottom;
  background-size: 20px 2px;
  background-repeat: repeat-x;
}

#my-input input {
  border-bottom: 0;
}
<div id="my-input">
  <input type="text">
</div>
D M
  • 5,769
  • 4
  • 12
  • 27