Materialize CSS Dropdowns

Materialize CSS provides dropdown facility. It provides several CSS classes to make ul element as a dropdown and add the id of the ul element to the data-activates attribute of the button or anchor element.

Following is the list of classes and their effects:

IndexClass nameDescription
1)dropdown-contentIt is used to identify ul as a materialize dropdown component. It is required for ul element.
2)data-activatesIt is used to specify id of the dropdown ul element.

How to use Dropdown?

To add a dropdown list to any button, you must ensure that the data-activates attribute matches the id in the <ul> tag. You can add a divider with the <li class="divider"></li> tag. You can also add icons. Just add the icon inside the anchor tag.

Example

Let's take an example to demonstrate dropdown:

Test it Now

Output:

Materialize Dropdowns 1
Materialize Dropdowns 2




Latest Courses