I am working on a format input field in html, css and js.
One example is a date format field with the following pattern: **.**.**** . When I type in the input fields, Chrome “scrolls” to the left when I get to the end of the window.
How can I prevent this?

The lines dividing each char are created by the background image. With a monospace font and a set of 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 fix this problem, I placed the input element in the div element, limited the div element to the width and added borders and overflow: none; in the div. Result: it works fine in Firefox, Chrome still scrolls the input content to the left.
Am I doing it wrong? Is there any other solution for this? Is there a -webkit property to prevent this? Thank you in advance!
source share