I am working on a format input field in html, css and js.
One example would be a date format field with following pattern: **.**.****
. When I am typing in the input fields, Chrome "scrolls" to the left when I reach the end of the box.
How can I prevent this?
The lines that separate each char are made by a background image. With a monospaced font and a set letter-spacing
each character goes into a "field". If you reach the size of the input field it scrolls forward and takes the background with it.
To resolve this problem, I put the input element into a div element, limited the div element to a width and added borders and overflow: none;
to the div. The result: It works fine in Firefox, Chrome still scrolls the input content to the left.
Am I doing this wrong? Is there an other solution for that? Is there a -webkit property to prevent this? Thank you in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…