I have a menu list that has a bigger distance between the last item and the item before the last. What I want to accomplish is that on scaling of the parent div's height, the distance should vanish but I also want to decrease the icons when the distance is 0 (should always be a margin-top between the items), but right now I am stuck on scaling where the last item overlaps the items before.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-
awesome/4.4.0/css/font-awesome.min.css">
<div class="scale">
<ul>
<li>
<i class="fa fa-search"></i>
</li>
<li>
<i class="fa fa-at"></i>
</li>
<li>
<i class="fa fa-ban"></i>
</li>
<li>
<i class="fa fa-cog"></i>
</li>
</ul>
</div>
This is so far what I got
codepen: css scalable menu
Related
I'm trying to add a div to each item in a Dropdown, however the item looses the bootstrap styling.
CSS
.ul.dropdown-menu li {
display: inline-block !important;
}
HTML
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">Example 2<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<div>
<a>Item One</a>
<div>
<i class="material-icons " style="font-size:18px">more_horiz</i>
</div>
</div>
</li>
</ul>
</li>
I've created examples of the dropdown before and after the additional element to demonstrate the issue.
https://jsfiddle.net/Rob_H/nqu621vm/
For continue same style they need a tag as root otherwise you can enhance css
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">Example 2
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a>
<div>
Item One
<div>
<i class="material-icons " style="font-size:18px">more_horiz</i>
</div>
</div></a>
</li>
<li>
<a>
<div>
Item One
<div>
<i class="material-icons " style="font-size:18px">more_horiz</i>
</div>
</div></a>
</li>
</ul>
</li>
Because bootstrap has a styles for .dropdown-menu>li>a but not for .dropdown-menu>li>div so you have to copy the needed styles from bootstrap dropdown and customize it for your needs.
Check the updated JSfiddle.
Hope this helps.
I can add icons next to texts in the menu but fails to hide text (keep icons only) in small screen.
<ul class="nav navbar-nav">
<li>
<a asp-area="" asp-controller="Home" asp-action="Index">
<span class="glyphicon glyphicon-home"></span>
Home
</a>
</li>
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
</ul>
Please help! Thanks.
Wrap your text in a div or span or paragraph, like this
<p class="hidden-xs">some text </p>
Wrap each menu item (text, without the glyph icon) in a span with a class of hidden-xs. This will hide the text and only leave the icons when the website is viewed on xs devices.
<span class="hidden-xs">Home</span>
<span class="hidden-xs">About</span>
<span class="hidden-xs">Contact</span>
Working demo on Codepen
Resize window to test it.
So my dropdowns all work fine but I've a main container div with a bg-color and as soon as the multi level dropdown menu goes over it the background doesn't display. The text is fine but the bg stops at the DIV margin.
I've tried using z-index at multiple stages even all the way up the nav div but nothing seems to work.
Has anyone experienced this before? Any ideas?
HTML Sample
<div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1" style="z-index:1;">
<ul class="nav navbar-nav">
<li><i class="fa fa-lg fa-home"></i> Home</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-lg fa-cog"></i> Tools</a>
<ul class="dropdown-menu multi-level">
<li class="">MAC Lookup</li>
<li>Locate ISP</li>
<li>PG&E Power Outages</li>
<li class="divider"></li>
I work with bootstrap 3+. i have this code for list inline with icon :
<ul class="list-inline">
<li>
<h2><i class="fa fa-book fa-2x"></i> test link</h2>
</li>
<li>
<h2><i class="fa fa-book fa-2x"></i> test link</h2>
</li>
</ul>
this worked but icon not in middle vertical align. how do fix this problem ?!
DEMO : FIDDLE
.fa {
vertical-align: middle;
}
demo - http://jsfiddle.net/z52bL7L6/1/
I'm working on a site that uses Bootstrap 3. I need to vertically align a button along the right side of a list item. In an attempt to do this, I am doing the following:
<ul class="list-unstyled list-info">
<li class="ng-binding ng-scope">
<label style="width:initial;" class="ng-binding">First Name Last Name</label><br>
Birthdate
<a ng-click="viewDetails()" class="btn-icon-round btn-icon-round-sm bg-success pull-right" style="vertical-align:middle;"><i class="fa fa-chevron-right"></i></a>
</li>
</ul>
How do I vertically center the icon in the right margin of the list item? I will have additional list items. For that reason, I need it in a list. However, I'm not sure how to do that.
Thank you!
One way to make it happen is to do something like this:
<ul class="list-inline">
<li>
<ul class="list-unstyled list-info">
<li class="ng-binding ng-scope">
<label style="width:initial;" class="ng-binding">First Name Last Name</label><br>
Birthdate
</li>
</ul>
</li>
<li>
<a ng-click="viewDetails()" class="btn-icon-round btn-icon-round-sm bg-success pull-right" style="vertical-align:middle;"><i class="fa fa-chevron-right"></i></a>
</li>
</ul>
Then pad the link to your discretion