I created a number field which has the text inside aligned to the right.
UseCase:
If you select the full text or when you use your middle mouse button inside of the input field to scroll I noticed that it is possible to scroll the text for about 1px to the left. So far I could only provoke this behavior in Chrome.
You can see it in action with this code:
<input type="number" value="15" style="text-align: right;" />
Solution:
I could probably disable the scrolling on the element but I wanted to ask you if there is an elegant way to fix this.
Here you can see the code: http://codepen.io/anon/pen/mEmAvz
2. Type "Remove Scrollbars" (without quotes) in the search box and press "Enter." Click the "Remove Scrollbars" option located on top of the search results.
An overflow issue occurs when a horizontal scrollbar unintentionally appears on a web page, allowing the user to scroll horizontally. It can be caused by different factors. It could occur because of unexpectedly wide content or a fixed-width element that is wider than the viewport.
To find out which elements cause a horizontal scrollbar, you can use the devtools to delete elements one by one until the scrollbar disappears. When that happens, press ctrl/cmd Z to undo the delete, and drill down into the element to figure out which of the child elements cause the horizontal scrollbar.
You could use text-indent with calc. Like so:
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
input {
width: 100%;
text-indent: calc(100% - 1.5em);
font-size: 1em;
}
https://jsfiddle.net/VilleKoo/u2ead3gz/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With