I have an input field (of variable width) with text which is longer than it can display. By default, it shows the leftmost section of the string (i.e. the first part of the string) and hides the excess (the rightmost part, i.e. the end of the string).
<input type="text" value="abcdefghijklmnopqrstuvwxyz" style="width: 25%; font-size: 25px; margin: 50px;">
When one clicks in the input field, one can move the window, and view any part of the string. When the cursor is at the end of the string, only the end section is displayed - the first part of the string is cut off, and hidden:
I want the input field to always look like this, by preferring to cut off the front of the string, rather than the end (simply because for this specific input the end of the string is more useful to see than the start).
Using text-align: right
unfortunately doesn't achieve this - it only causes the text to be right aligned when the full text can fit:
I'd rather not use JS to cut the length of the string, as this would prevent the user being able to edit it.
To be clear, I would like this to happen all the time, rather than only when it's focused via Use JavaScript to place cursor at end of text in text input element