I need a method to give the options (the dropdown) of a native select element the same width as the select field.
So if I give a select field the width 8rem using css (select { width: 8rem}) then I want all elements in my dropdown to be 8rem wide as well. If the text of an option is longer, it should wrap.
Is this somehow possible with a native select? I am not allowed to use/build a custom select field for accessibility reasons. I know select fields are hard to style but maybe there is a good workaround im not aware of.
I can use javascript, css and html.
3
Im not overly confident in CSS but from what i Know cant you just set the options inside of the select to inherit the width of the select module and then have a wrap rule in the css file per option?
3