I am prettyn new in Twitter BootStrap and I have the following problem.
I know that BootStrap provide a drop down menu, something like this: http://getbootstrap.com/components/#dropdowns-example
Implementing in this way:
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Dropdown
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
As you can see it show a button with Dropdown as text and when the button is clicked the menu voices are shown.
Now my problem is that i want something like this but I need to have a clickable icon, when the icon is clicked the drop down menu is shown (as is in FaceBook where clicking on the down arrow in the main menu you obtain a sub menu related to your profile).
How can I implement something like this using BootStrap?
3
Answers
You could do it like so… using css background and setting appropriate size
Change this part
to
and replace the word ‘glyphicon’ with the corresponding name of the icon you want to use from Bootstrap’s glyphicon library
eg.
for a heart icon on your dropdown
Simply replace your code
to
You can replace your img source with whichever icon you desire, add some additional style to make it awesome.
For Eg. I’ve used facebook’s icon.