DEV Community

anjan-dutta
anjan-dutta

Posted on • Updated on

How to create a custom select dropdown in HTML, CSS and Javascript

Select is a form element in HTML. I am going to tell you in this article how to style a select option in CSS.

You might think what is so special about styling a select option in CSS. For those who do not know it, it’s a bit difficult to do so.

We can change styling for some parts of a select element tbh. But the real problem comes when we try to re-design the dropdown option list. See this article for reference Styling with CSS.

It doesn’t work because the internal structure of a select element is complex. We can change the default appearance and font, but these changes are not enough to align the design with modern controls.

In simple words, CSS can not change the dropdown menu list’s design.

Then what is the solution?

The solution is to create a custom select element than to style a select option in CSS explicitly.

Read more...

Discussion (0)