How to limit the options of a select?

Asked

Viewed 944 times

-2

I made a modal form in materialize-css and in this form there are several fields, including one that is (what I have problems with), it is the Brazilian states, ie 27 states. And when you click on the select it appears a gigantic list with the 27 states and wanted you to view only 3 and the user went down the scrollbar to view the rest... First of all, I’ve tried the size attribute in html, and it just doesn’t work (I think it’s something from materialize), besides, I also tried in css to change the height, but it doesn’t specifically change what I want, which is to hide the rest. Thank you for your attention.

  • Include the form in the question so that you are aware of your real difficulty, preferably with your various attempts

  • Place the entire HTML, including with <head>, and the CSS you’re using as well.

  • https://github.com/ricknunesmendes/adot.io

1 answer

0


You can add this to your CSS

.dropdown-content {
    max-height: 200px;
}

In the max-height you will set the maximum size of the dropdown which is open with the options, 200px is about the size for 3 options.

I hope it helps!

  • I tried, but he’s gone, it’s incredible. haha Even I put it in git like this, if you want to see you can check https://github.com/ricknunesmendes/adot.io

  • I managed to edit this directly in the materialize, thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.