Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
How can I make materalize dropdown options the same size as the dropdown button

I am trying to make the dropdown options the same size as my dropdown button, using materializes dropdown menu.

Like you can see below, the dropdown options are wider than the button itself. Even with contrainWidth: true. Does anyone know how to make them be the same size? Thanks.

enter image description here

https://jsfiddle.net/L7hop0fz/103/

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

  <a class="dropdown-trigger btn-large light-blue lighten-3 black-text" id="chartsBtn" data-target='dropdownCharts'><i class="material-icons center">chevron_right</i></a>

  <ul id='dropdownCharts' class='.custom2 dropdown-content light-blue lighten-3 black-text'>
    <li class=""><a href="#!" ><i class="material-icons center">equalizer</i></a></li>
    <li class=""><a href="#!" ><i class="material-icons center">show_chart</i></a></li>
    <li class=""><a href="#!"><i class="material-icons center">multiline_chart</i></a></li>
  </ul>

Javascript initialize:

$('.dropdown-trigger').dropdown({
  alignment: 'right',
  hover: true,
  constrainWidth: true,
  coverTrigger: false,
  closeOnClick: false,
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

in styles on .dropdown-content ,min-widtht: 100px have seted and this is cause of your problem. set min-width: unset to fix it.
and to fix arrow problem , you can put codes into a container.

$('.dropdown-trigger').dropdown({
      alignment: 'right',
      hover: true,
      constrainWidth: true,
      coverTrigger: false,
      closeOnClick: false,
    });
#dropdownCharts a{
    color: black;
}

#container:hover #chartsBtn .material-icons {
    transform: rotate(+90deg);
}


#dropdownCharts li{
    width: auto;
}

ul.dropdown-content{
    min-width: unset;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

  <span id="container">
  <a class="dropdown-trigger btn-large light-blue lighten-3 black-text" id="chartsBtn" data-target='dropdownCharts'><i class="material-icons center">chevron_right</i></a>


  <ul id='dropdownCharts' class='.custom2 dropdown-content light-blue lighten-3 black-text'>
    <li class=""><a href="#!" ><i class="material-icons center">equalizer</i></a></li>
    <li class=""><a href="#!" ><i class="material-icons center">show_chart</i></a></li>
    <li class=""><a href="#!"><i class="material-icons center">multiline_chart</i></a></li>
  </ul>
  </span>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!