#Styling datalist
1 messages · Page 1 of 1 (latest)
datalist is just a tag, you can use it in css selectors like any other tag, combine it with class names etc. like
<datalist class="snowflake">
datalist.snowflake {
...
}
ah, well I don't think it's used in rendering at all, just its contents https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist
it seems the rendering of datalist is based on how the os/browser interprets it with its builtin widget, no way to override that. you can suppress it and add a custom widget/dropdown by tying to the events
https://chriswarrick.com/blog/2020/02/09/when-html-is-not-enough-a-tale-of-the-datalist-element/
The element sounds like a good idea, but browser support issues make the experience worse than a custom autocomplete widget.
since that means a lot of work you may want to look into specialized libraries instead like https://select2.org/
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.