wondering if anyone has any tips on how to increase the dropdown width?
I have a row containing two columns with a a bit of javascript that slides the dropdown up an
Update 2018
You should be able to just set it using CSS like this..
.dropdown-menu {
min-width:???px;
}
This works in both Bootstrap 3 and Bootstrap 4.0.0 (demo).
A no extra CSS option in Bootstrap 4 is using the sizing utils to change the width. For example, here the w-100 (width:100%) class is used for the dropdown menu to fill the width of it's parent....
<ul class="dropdown-menu w-100">
<li><a class="nav-link" href="#">Choice1</a></li>
<li><a class="nav-link" href="#">Choice2</a></li>
<li><a class="nav-link" href="#">Choice3</a></li>
</ul>
https://www.codeply.com/go/pAqaPj59N0
You can for example just add a "col-xs-12" class to the <ul>
which holds the list items:
<div class="col-md-6" data-toggle="dropdown">
First column
<ul class="dropdown-menu col-xs-12" role="menu" aria-labelledby="dLabel">
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
</ul>
</div>
This worked ok on any screen resolution in my site. The class will match the list width to it's containing div I believe:
Text will never wrap to the next line. The text continues on the same line until a
tag is encountered.
.dropdown-menu {
white-space: nowrap;
}
If you have BS4 another option could be:
.dropdown-item {
width: max-content !important;
}
.dropdown-menu {
max-height: max-content;
max-width: max-content;
}
Add the following css class
.dropdown-menu {
width: 300px !important;
height: 400px !important;
}
Of course you can use what matches your need.
Usually the desire is to match the menu width to the width of the dropdown parent. This can be achieved easily like so:
.dropdown-menu {
width:100%;
}