I have defined a dropdwon as fellow:
<div class="form-group">
<select class="form-control">
<option>small option</option>
<option>mediummmmmmmmmmmmmmmmmmmm option</option>
<option>large eeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeee eeeeeeeeeeeee eeee option</option>
</select>
</div>
I want to change select
width to be minimum of container width and option
text width. If option
text is bigger than div
container, truncate option's text and put ellipsis at the end. So the option
stays inside the container. Also select
must be responsive, When resizing window, select
width should be updated to fit new window width.
How can I achieve that using bootstrap CSS?
Method 2: We can make the display attribute of the child container to table-row and display attribute of parent container to table, that will take all the height available from the parent div element. To cover all the width, we can make the width of parent div to 100%.
One way you can achieve this is setting display: inline-block; on the div . It is by default a block element, which will always fill the width it can fill (unless specifying width of course).
try width:100%;
It works for me each element in ListView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With