0
I’m having a problem disposing a dropdown of images in bootstrap, dropdown this that is inside a navbar
html code:
<nav class="navbar navbar-default navbar-fixed-top" role="navigation"><!--------- START Navbar --------->
<div class="container">
<div class="navbar-header"><!-- START Brand and toggle get grouped for better mobile display -->
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Meu Site</a>
</div><!-- END Brand and toggle get grouped for better mobile display -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"><!-- START Collect the nav links, forms, and other content for toggling -->
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" style="padding-top:0;padding-bottom:0" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<img src="../../../images/icon/share-icon.png"
alt="share"/>
</a>
<ul class="dropdown-menu" role="menu" style="min-width:80px;">
<li style="width:50px;">
<a href="#"><img src="../../../images/icon/twitter-icon.png"
alt="twitter"/></a>
</li>
<li style="width:50px;">
<a href="#"><img src="../../../images/icon/facebook-icon.png"
alt="facebook"/></a>
</li>
<li style="width:50px;">
<a href="#"><img src="../../../images/icon/tumblr-icon.png"
alt="tumblr"/></a>
</li>
</ul>
</li>
</ul>
</div><!-- END Collect the nav links, forms, and other content for toggling -->
</div>
</nav><!--------- END Navbar --------->
the result:
I added Paddings to the images (50px) so that it has the exact size of the navbar (50px) but without success (it is a gray frame around), and the size of the space of the icons also does not get 50px (image size)
Ilá ,@fricks modified his answer to act only on the icon dropdown (I will have another one in the future), I added the css directly in html but I will put it in a separate file later, I edited the question
– Ricardo
images are not centered
– Ricardo
Do you want to leave the ul dropdown with 80px? And the images with 50px and center them?
– João Paulo Fricks
Yes I want to center the images
– Ricardo
Just add text-align:center na li
– João Paulo Fricks
It didn’t work just testing, I also tested class=text-center
– Ricardo
Look at the example http://www.bootply.com/8KXADmi6JX, it’s working.
– João Paulo Fricks