The margin-top property should not use px units.
When visiting your CSS generator at https://range-input-css.netlify.app/, we see this CSS declaration:
margin-top: -4px; /* Centers thumb on the track */
When using rem units for the track or thumb heights, this margin will remain the same when a user selects a non-default font-size. The thumb won't be vertically centered.
So it seems that calc should be used for margin-top:
margin-top: calc((var(--track-height) - var(--thumb-height)) / 2); /* Centers thumb on the track */
The
margin-topproperty should not usepxunits.When visiting your CSS generator at https://range-input-css.netlify.app/, we see this CSS declaration:
When using
remunits for the track or thumb heights, this margin will remain the same when a user selects a non-default font-size. The thumb won't be vertically centered.So it seems that
calcshould be used formargin-top: