7
I am using Bootstrap to make a bar at the top of the page, and I have a problem:
What I need is to open the dropdown, have a list of options, and an image next to it that always has the same size of the list, as picture below.
I achieved this by setting a fixed height and width in the image, but the list can grow and I can’t keep changing in the hand.
One solution that would work is to put a div involving the list and the image, and set the image size to 100%, but in doing so, the dropdown is no longer activated (I believe I end up breaking the structure that the bootstrap uses to activate the dropdown).
How can I achieve this solution?
Thank you!
<div id="navbar" class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav top-elements">
<li id="dropdown-produtos" class="dropdown">
<a href="#" class="dropdown-toggle text-uppercase top-text" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Nossos Produtos<span class="caret top-caret"></span></a>
<!-- a div ia aqui --> <ul class="dropdown-menu dropdown-menu-produtos">
<li class="dropdown-item-active">
<a href="#" class="dropdown-item-description">texto1</a>
<ul class="dropdown-menu img-dropdown">
<img src="assets/img.png">
</ul>
</li>
<li class="dropdown-item">
<a href="#" class="dropdown-item-description">texto2</a>
</li>
<li class="dropdown-item"><a href="#" class="dropdown-item-description">texto3</a></li>
<li class="dropdown-item"><a href="#" class="dropdown-item-description">texto4</a></li>
<li class="dropdown-item"><a href="#" class="dropdown-item-description">texto5</a></li>
</ul>
</li>
</ul>
</div>
You said the list could grow. What would it look like if the image wasn’t the same as the list size? You’d keep the rest blank?
– Randrade
@Randrade the ideal is that the image always fits the size of the list, inheriting the height of the list.
– Victor Alencar Santos