Jig*_*hal 15 html javascript css jquery
当我输入最后一个数字时,第一个数字进入text-box(它消失)里面,它增加了一个额外的空格。
在我点击外部后,text-box它看起来不错,这是我在输入最后一个字符时需要的。
#number_text {
padding-left: 9px;
letter-spacing: 31px;
border: 0;
background-image: linear-gradient(to right, #e1e1e1 70%, rgba(255, 255, 255, 0) 0%);
background-position: left bottom;
background-size: 38px 1px;
background-repeat: repeat-x;
width: 220px;
box-sizing: border-box;
outline:none;
}Run Code Online (Sandbox Code Playgroud)
<input type="text" id="number_text" maxlength="6" pattern="\d{6}" value="1234" >Run Code Online (Sandbox Code Playgroud)
帮助我摆脱这个问题。谢谢
为另一个数字添加空间并使用剪辑输入 clip-path
#number_text {
padding-left: 9px;
letter-spacing: 31px;
border: 0;
background:
repeating-linear-gradient(to right, #e1e1e1 0 26px, transparent 26px 38px)
bottom/100% 1px no-repeat;
width: 260px;
clip-path:polygon(0 0, calc(100% - 38px) 0, calc(100% - 38px) 100%, 0 100%);
box-sizing: border-box;
outline: none;
}Run Code Online (Sandbox Code Playgroud)
<input type="text" id="number_text" maxlength="6" pattern="\d{6}" value="1234">Run Code Online (Sandbox Code Playgroud)
或者通过减少背景大小而没有剪辑路径:
#number_text {
padding-left: 9px;
letter-spacing: 31px;
border: 0;
background:
repeating-linear-gradient(to right, #e1e1e1 0 26px, transparent 26px 38px)
bottom left/calc(100% - 38px) 1px no-repeat;
width: 260px;
box-sizing: border-box;
outline: none;
}Run Code Online (Sandbox Code Playgroud)
<input type="text" id="number_text" maxlength="6" pattern="\d{6}" value="1234">Run Code Online (Sandbox Code Playgroud)