Skip to content

Range Component: Centered labels on the slider #3234

Answered by saadeghi
fredbradley asked this question in Q&A
Discussion options

You must be logged in to vote

Here's an example: https://play.tailwindcss.com/GMTyPd5pql

I used grid instead of flex so all 5 columns get equal width. We want the range thumb to be aligned with the line from first item and last item, and there are 5 columns which means we need 10% horizontal margin for the range + the size of thumb (which is 32px). So w-[calc(80%+32px)] would make range fit exactly to the scale.

Let me know if you have a question.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@fredbradley
Comment options

@saadeghi
Comment options

Answer selected by fredbradley
@fredbradley
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants