Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
84
rated 0 times [  89] [ 5]  / answers: 1 / hits: 100145  / 11 Years ago, tue, september 3, 2013, 12:00:00

How can I set the width of a dropdown triggering button in bootstrap 3.0 to be equal to the width of the dropdown list? Similar to what is achieved when using bootstrap-select (http://silviomoreto.github.io/bootstrap-select/). I have tried to wrap the whole list in a div with a col-* class, but that doesn't seem to work:



<div class=row>
<div class=col-xs-4 col-md-4>
<div class=dropdown>
<button type=button class=btn btn-danger dropdown-toggle data-toggle=dropdown>Button</button>
<ul class=dropdown-menu role=menu>
<li><a href=#>Action</a></li>
<li><a href=#>Action</a></li>
<li><a href=#>Action</a></li>
</ul>
</div>
</div>




Thus, I would like: button width = dropdown menu list = col-* width.


More From » html

 Answers
5

I found the solution by setting the dropdown-menu and button width=100%.



.dropdown-menu {
width: 100%;
}

.btn{
width: 100%;
}


Now both the button and dropdown list have the same width, controlled by the column width.


[#75933] Monday, September 2, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ninaemiliaj

Total Points: 405
Total Questions: 112
Total Answers: 112

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
;