I have one dropdown inside bootstrap grid .If i click the dropdown the height of the row also increase. But, Here not increasing.How to do it?
HTML:
<div class="container">
<div class="row">
<div class="col-12">
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
</div>
</div>
</div>
CSS:
.row{
border: 1px solid;
height:auto;
}
.col-12{
border: 1px solid;
display: block;
}
Expecting like below:
Demo: https://stackblitz.com/edit/angular-bootstrap-grid-system-z8bqwk?file=src%2Fapp%2Fapp.component.html
2
Answers
CSS properties are inherent to flexbox. Columns in a Bootstrap row will have the same height by default.
If you need to ensure that the contents of your dropdown can overflow beyond the limits of the row, you should set the
min-height
to a minimum amount to show it.Something like this:
I am not sure if you can style the native dropdown list so it’s options take space on the page, so I provided an alternative with your desired outcome using a custom dropdown.
Check this:
You can access the dropdown value in the variable
selectedOptionValue
.