Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Make a select the width of the chosen option

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #152295
    lukefrake
    Participant

    Hello All,

    I want to make a select that will dynamically change size depending on what option has been chosen.

    I have been rattling my brain with a way to do this with pure css and I just can’t seem to get it to work, does anybody have any ideas?

    I have made a really basic codepen of what I mean here

    #152300
    Paulie_D
    Moderator

    Pretty much impossible with standard select boxes.

    These are browser specific and, generally, styled by the browser user agent.

    As far as I know the select dropdown options will always be a fixed width wide enough to show the longest option.

    https://css-tricks.com/dropdown-default-styling/

    Pretty much you only option is to hide/replace with another set of elements.

    #152309
    lukefrake
    Participant

    Yeah thats kind of what I thought just wanted a few other opinions on it :)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.