HTML and CSS
.pickthetime {
height: calc(var(--vh, 1vh) * 3);
width: calc(var(--vw, 1vw) * 25);
align-content: center; // center looks better, also tried left to stop it from breaking a new line on Safari on iOS
font-weight: 300;
}
<input class="pickthetime" type="time" id="pickthetime" name="pickthetime" required />
I'm facing an issue with scaling the font size of a time picker based on its size. No matter what adjustments I make in the CSS, the font size is either too big or too small on different devices. Even using
calc(var(--vw, 1vw) * somenumberhere)
doesn't provide consistent results across devices like Android phones or iPhones.
Even after trying libraries like FitText, the problem persists. The font size may scale slightly better on Chrome, yet displays differently on iPhone models or other mobile browsers.
https://i.sstatic.net/X1juB.jpg
https://i.sstatic.net/Q8wXC.jpg
https://i.sstatic.net/B5Jh9.jpg
https://i.sstatic.net/EDa2I.jpg
Despite various attempts, I am unable to find a solution that works consistently across all devices. Ideally, I want the font size to adjust according to the width of the time picker without being obscured by browser-specific icons like the clock icon in Chrome or the arrow down icon in Safari on iOS.