Setting the width of selects to the width of the selected option

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

The field-sizing property is coming to Firefox 152, making it available across all major engines. It allows you to control the sizing behavior of elements with a default preferred size, such as form elements.

Sometimes a new CSS feature comes along and I immediately “get it”. Like: that’s a cool new feature, I can already see how it’ll save me time, or make things simpler, or improve accessibility, or allow me to do something new.

Other times, like this one, I initially shrug. What’s the point?, I think…

…and then later in the very same day find occasion to wish it was already mainstream. Hah!

Thanks for sharing, Manuel.

0 comments

    Reply here

    Your email address will not be published. Required fields are marked *

    Reply on your own site

    Reply elsewhere

    You can reply to this post on Mastodon (@blog@danq.me).

    Reply by email

    I'd love to hear what you think. Send an email to b29526@danq.me; be sure to let me know if you're happy for your comment to appear on the Web!