gogi100 Posted September 15, 2016 Share Posted September 15, 2016 i have listbox in the form of <select><option>I'm short</option><option>I'm medium text</option><option>I'm a very very very very very very very very very long text</option> <option>I'm a very very very very very very very very very long text</option> <option>I'm short</option> </select> how i can wrap text to long text of option elements? i know that i can to make with css but code cannot wrap text. some javascript maybe? Link to comment Share on other sites More sharing options...
Eyad Syria-lover Posted September 15, 2016 Share Posted September 15, 2016 You Should Increase The Width Of The <select> Element: <select style="width:100%;"> Link to comment Share on other sites More sharing options...
Ingolme Posted September 15, 2016 Share Posted September 15, 2016 You Should Increase The Width Of The <select> Element: <select style="width:100%;"> That won't work. The options won't wrap, they'll just be cut off. Form elements are limited in how they can be styled. To my knowledge there's no way to force an option to wrap its text. 1 Link to comment Share on other sites More sharing options...
dsonesuk Posted September 16, 2016 Share Posted September 16, 2016 The only way I have seen this done, is to hide the select and options elements, create clone of text values into other elements (maybe ul,li) to create dropdown, which you can now wrap, then use JavaScript to on a specific clicked list item, apply the same value as selected in hidden select option list. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now