how to change display width of datalist

user3861163 picture user3861163 · Aug 14, 2014 · Viewed 18.8k times · Source

i have a simple issue with HTML datalist but somehow cant solve this problem. i've tried to change the displayed width for the following datalist:

but no matter what i try, it still cuts down the "long" option values. how can i change that, so that the datalist shows all the option values, no matter how long they are?

best regards

Answer

Diego Rodriguez picture Diego Rodriguez · Nov 13, 2015

<input list="browsers" name="browser" style="width: 100px;">

  <datalist id="browsers">
   <option value="this is a really long name for a browser">
   <option value="Firefox">
   <option value="Chrome">
   <option value="Internet Explorer">
  </datalist>

<input type="submit">