Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add vertical scroll in HTML DataList tag [duplicate]

I have a datalist with lot of option, The list goes too long I want to give it vertical scroll.

<input list="browsers" name="browser">
  <datalist id="browsers">
    <option value="Internet Explorer">
    <option value="Firefox">
    <option value="Chrome">
    <option value="Opera">
    <option value="Safari">
<option value="Internet Explorer">
    <option value="Firefox">
    <option value="Chrome">
    <option value="Opera">
    <option value="Safari">
<option value="Internet Explorer">
    <option value="Firefox">
    <option value="Chrome">
    <option value="Opera">
    <option value="Safari">
  </datalist>

Here the demo Problem
FIDDLE

like image 832
ozil Avatar asked Jan 28 '15 11:01

ozil


1 Answers

Unfortunately, there's not much you can do with the datalist attribute. The datalist does not currently support any CSS styling, and specific visual characteristics are browser-specific. Some browsers may choose to add scrollbars for long lists. If this isn't acceptable, you may have to forget the datalist and implement a dropdownlist and set the list size as per your needs.

like image 196
rajesh Avatar answered Nov 10 '22 12:11

rajesh