For some reason I can't get my last nav link to stay with the rest of them. I can do this if i set .dropdown ul li .menu position to absolute, but then the drop down links are pushed to the right and not centered. Padding-right nor margin-right doesn't resolve this issue.
JSFiddle
Before
After
Position: Absolute
.title {
font-family: 'Philosopher', sans-serif;
margin-left: 20px;
color: white;
float: left;
padding-right: 70px;
padding-top: 5px;
}
#body {
background-color: black;
}
.dropdown ul {
padding-top: 10px;
}
.dropdown ul li .menu {
position: absolute;
float: none;
}
.menu-hover-lines {
margin-top: 35px;
float: right, bottom;
text-align: center;
text-transform: uppercase;
font-weight: 400;
letter-spacing: 3px;
transition: all 0.35s ease;
}
.menu-hover-lines li a {
padding: 0.75rem 0;
color: white;
position: relative;
margin-left: 1rem;
margin-right: 4rem;
margin-top: 20px;
}
.menu-hover-lines li:first-child a {
margin-left: 10px;
}
.menu-hover-lines li.active > a {
background-color: transparent;
}
/* Nav transition settings */
.menu-hover-lines a::before,
.menu-hover-lines a::after {
height: 3px;
position: absolute;
content: '';
transition: all 0.40s ease;
background-color: #932929;
width: 0;
}
.menu-hover-lines a::before {
top: 0;
left: 0;
}
.menu-hover-lines a::after {
bottom: 0;
right: 0;
}
/* Nav text settings on hover*/
.menu-hover-lines a:hover,
.menu-hover-lines li.active > a {
color: #8e8e8e;
transition: all 0.40s ease;
}
.menu-hover-lines a:hover::before,
.menu-hover-lines .active a::before,
.menu-hover-lines a:hover::after,
.menu-hover-lines .active a::after {
width: 100%;
}
.dropdown li .menu {
display: none;
}
.dropdown li:hover .menu {
display: inline-block;
float: none;
}
<!-- Nav Bar -->
<div class="dropdown" >
<ul class="menu dropdown menu-hover-lines" data-dropdown-menu>
<li>Home</li>
<li >Collections
<ul class="menu">
<li>Autos</li>
<li>Models</li>
<li>Extreme Sports</li>
</ul>
</li>
<li>About me</li>
<li>Get in touch
<ul class="menu">
<li><i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i></li>
<li><i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i></li>
<li><i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i></li>
</ul>
</li>
</ul>
</div>
I think you need to add left:0 and top:100% to your dropdown-menu with position:absolute. Remember to add position:relative to your .menu>li...
I have added .dropdown-menu class in the dropdown ul...
Also I noticed that you have written float: right, bottom in your css which is not valid...
Stack Snippet
body {
font: 13px Verdana;
}
.menu {
padding: 0;
display: flex;
}
.menu>li {
margin: 0 10px;
list-style: none;
position: relative;
}
.menu li a {}
.dropdown-menu {
padding: 0;
position: absolute;
top: 100%;
left: 0;
border: 1px solid;
padding: 10px;
}
.dropdown-menu>li {
list-style: none;
}
<!-- Nav Bar -->
<div class="dropdown">
<ul class="menu dropdown menu-hover-lines" data-dropdown-menu>
<li>Home</li>
<li>Collections
<ul class="dropdown-menu">
<li>Autos</li>
<li>Models</li>
<li>Extreme Sports</li>
</ul>
</li>
<li>About me</li>
<li>Get in touch
<ul class="menu">
<li><i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i></li>
<li><i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i></li>
<li><i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i></li>
</ul>
</li>
</ul>
</div>
Related
I'm tying to get a ul to drop down a few link icons, but no matter what I type, the only thing that changes is the orientation of the icons. I feel like I'm missing something rather simple, but nor Google or Foundation's website have helped. I've tried calling to the nested ul using .menu li a i {}, but that's wrong. I've tried other ways as well with no positive results.
/* Styles go here */
.menu-hover-lines {
margin-top: 30px;
float: right, bottom;
text-align: center;
text-transform: uppercase;
font-weight: 500;
letter-spacing: 3px;
transition: all 0.35s ease;
}
.menu-hover-lines li a {
padding: 0.75rem 0;
color: #333;
position: relative;
margin-left: 1rem;
margin-right: 4rem;
margin-top: 20px;
}
.menu-hover-lines li.active>a {
background-color: transparent;
}
/* Nav transition settings */
.menu-hover-lines a::before,
.menu-hover-lines a::after {
height: 3px;
position: absolute;
content: '';
transition: all 0.40s ease;
background-color: #932929;
width: 0;
}
.menu-hover-lines a::before {
top: 0;
left: 0;
}
.menu-hover-lines a::after {
bottom: 0;
right: 0;
}
.menu-hover-lines a:hover::before,
.menu-hover-lines .active a::before,
.menu-hover-lines a:hover::after,
.menu-hover-lines .active a::after {
width: 100%;
}
.menu li a>i {
display: none;
}
.menu i:hover {
display: inline;
}
<script src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css" rel="stylesheet" />
<ul class="menu dropdown vertical menu-hover-lines" data-dropdown-menu="">
<li>
Get in touch
<ul class="menu">
<li>
<a href="#">
<i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i>
</a>
</li>
<li>
<a href="http://twitter.com">
<i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i>
</a>
</li>
<li>
<a href="http://instagram.com">
<i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i>
</a>
</li>
</ul>
</li>
</ul>
you have to add a div to the outside of all your content for the hover effect
/* Styles go here */
.menu-hover-lines {
margin-top: 30px;
float: right, bottom;
text-align: center;
text-transform: uppercase;
font-weight: 500;
letter-spacing: 3px;
transition: all 0.35s ease;
}
.menu-hover-lines li a {
padding: 0.75rem 0;
color: #333;
position: relative;
margin-left: 1rem;
margin-right: 4rem;
margin-top: 20px;
}
.menu-hover-lines li.active>a {
background-color: transparent;
}
/* Nav transition settings */
.menu-hover-lines a::before,
.menu-hover-lines a::after {
height: 3px;
position: absolute;
content: '';
transition: all 0.40s ease;
background-color: #932929;
width: 0;
}
.menu-hover-lines a::before {
top: 0;
left: 0;
}
.menu-hover-lines a::after {
bottom: 0;
right: 0;
}
.menu-hover-lines a:hover::before,
.menu-hover-lines .active a::before,
.menu-hover-lines a:hover::after,
.menu-hover-lines .active a::after {
width: 100%;
}
ul .menu {
display: none;
}
.drop_down:hover ul .menu{
display: inline;
}
<script src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css" rel="stylesheet" />
<div class="drop_down">
<ul class="menu dropdown vertical menu-hover-lines" data-dropdown-menu="">
<li>
Get in touch
<ul class="menu">
<li class="content">
<a href="#">
<i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i>
</a>
</li>
<li class="content">
<a href="http://twitter.com">
<i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i>
</a>
</li>
<li class="content">
<a href="http://instagram.com">
<i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i>
</a>
</li>
</ul>
</li>
</ul>
</div>
I am working on a navigation sidebar with icons which on hover display text along with icon with reference to JFarrow's https://codepen.io/JFarrow/pen/fFrpg
<li>
<a href="http://justinfarrow.com">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">Dashboard</span>
</a>
</li>
But in my case I would like to hide icons when I hover on the sidebar and display only text.
May I know a best way to do this?
A pure css solution would be the next:
Hope this helps
Hice icon image
nav.main-menu:hover i:before {
display: none;
}
Adapt sidebar width
nav.main-menu:hover {
width:200px;
}
Reduce icon space
nav.main-menu:hover .fa{
width: 10px;
}
Added snipet so everyone can try it
#import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
}
#import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
.fa-2x {
font-size: 2em;
}
.fa {
position: relative;
display: table-cell;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size: 20px;
}
.main-menu:hover,
nav.main-menu.expanded {
width: 250px;
overflow: visible;
}
.main-menu {
background: #212121;
border-right: 1px solid #e5e5e5;
position: absolute;
top: 0;
bottom: 0;
height: 100%;
left: 0;
width: 60px;
overflow: hidden;
-webkit-transition: width .05s linear;
transition: width .05s linear;
-webkit-transform: translateZ(0) scale(1, 1);
z-index: 1000;
}
.main-menu>ul {
margin: 7px 0;
}
.main-menu li {
position: relative;
display: block;
width: 250px;
}
.main-menu li>a {
position: relative;
display: table;
border-collapse: collapse;
border-spacing: 0;
color: #999;
font-family: arial;
font-size: 14px;
text-decoration: none;
-webkit-transform: translateZ(0) scale(1, 1);
-webkit-transition: all .1s linear;
transition: all .1s linear;
}
.main-menu .nav-icon {
position: relative;
display: table-cell;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size: 18px;
}
.main-menu .nav-text {
position: relative;
display: table-cell;
vertical-align: middle;
width: 190px;
font-family: 'Titillium Web', sans-serif;
}
.main-menu>ul.logout {
position: absolute;
left: 0;
bottom: 0;
}
.no-touch .scrollable.hover {
overflow-y: hidden;
}
.no-touch .scrollable.hover:hover {
overflow-y: auto;
overflow: visible;
}
a:hover,
a:focus {
text-decoration: none;
}
nav {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
nav ul,
nav li {
outline: 0;
margin: 0;
padding: 0;
}
.main-menu li:hover>a,
nav.main-menu li.active>a,
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-menu>.active>a,
.dropdown-menu>.active>a:hover,
.dropdown-menu>.active>a:focus,
.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,
.dashboard-page nav.dashboard-menu ul li.active a {
color: #fff;
background-color: #5fa2db;
}
.area {
float: left;
background: #e2e2e2;
width: 100%;
height: 100%;
}
#font-face {
font-family: 'Titillium Web';
font-style: normal;
font-weight: 300;
src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
}
nav.main-menu:hover i:before {
display: none;
}
nav.main-menu:hover {
width: 200px;
}
nav.main-menu:hover .fa {
width: 10px;
}
<html>
<head>
</head>
<body>
<div class="area"></div>
<nav class="main-menu">
<ul>
<li>
<a href="http://justinfarrow.com">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
Dashboard
</span>
</a>
</li>
<li class="has-subnav">
<a href="#">
<i class="fa fa-laptop fa-2x"></i>
<span class="nav-text">
UI Components
</span>
</a>
</li>
<li class="has-subnav">
<a href="#">
<i class="fa fa-list fa-2x"></i>
<span class="nav-text">
Forms
</span>
</a>
</li>
<li class="has-subnav">
<a href="#">
<i class="fa fa-folder-open fa-2x"></i>
<span class="nav-text">
Pages
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-bar-chart-o fa-2x"></i>
<span class="nav-text">
Graphs and Statistics
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-font fa-2x"></i>
<span class="nav-text">
Typography and Icons
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-table fa-2x"></i>
<span class="nav-text">
Tables
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-map-marker fa-2x"></i>
<span class="nav-text">
Maps
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-info fa-2x"></i>
<span class="nav-text">
Documentation
</span>
</a>
</li>
</ul>
<ul class="logout">
<li>
<a href="#">
<i class="fa fa-power-off fa-2x"></i>
<span class="nav-text">
Logout
</span>
</a>
</li>
</ul>
</nav>
</body>
</html>
You will need to set width:0 and visibility:hidden to the fa on .main-menu:hover
Also use flexbox...don't use table on <a> elements.
.main-menu:hover .fa {
width: 0;
visibility: hidden;
}
Stack Snippet
#import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
}
#import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
.fa-2x {
font-size: 2em;
}
.fa {
position: relative;
width: 60px;
height: 36px;
line-height: 36px;
text-align: center;
font-size: 20px;
}
.main-menu:hover,
nav.main-menu.expanded {
width: 250px;
overflow: visible;
}
.main-menu {
background: #212121;
border-right: 1px solid #e5e5e5;
position: absolute;
top: 0;
bottom: 0;
height: 100%;
left: 0;
width: 60px;
overflow: hidden;
-webkit-transition: width .05s linear;
transition: width .05s linear;
-webkit-transform: translateZ(0) scale(1, 1);
z-index: 1000;
}
.main-menu>ul {
margin: 7px 0;
}
.main-menu li {
position: relative;
display: block;
width: 250px;
}
.main-menu li>a {
position: relative;
display: flex;
align-items: center;
border-spacing: 0;
color: #999;
font-family: arial;
font-size: 14px;
text-decoration: none;
-webkit-transform: translateZ(0) scale(1, 1);
-webkit-transition: all .1s linear;
transition: all .1s linear;
}
.main-menu .nav-icon {
position: relative;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size: 18px;
}
.main-menu .nav-text {
position: relative;
width: 190px;
font-family: 'Titillium Web', sans-serif;
}
.main-menu>ul.logout {
position: absolute;
left: 0;
bottom: 0;
}
.no-touch .scrollable.hover {
overflow-y: hidden;
}
.no-touch .scrollable.hover:hover {
overflow-y: auto;
overflow: visible;
}
a:hover,
a:focus {
text-decoration: none;
}
nav {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
nav ul,
nav li {
outline: 0;
margin: 0;
padding: 0;
}
.main-menu li:hover>a,
nav.main-menu li.active>a,
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-menu>.active>a,
.dropdown-menu>.active>a:hover,
.dropdown-menu>.active>a:focus,
.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,
.dashboard-page nav.dashboard-menu ul li.active a {
color: #fff;
background-color: #5fa2db;
}
.area {
float: left;
background: #e2e2e2;
width: 100%;
height: 100%;
}
#font-face {
font-family: 'Titillium Web';
font-style: normal;
font-weight: 300;
src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
}
.main-menu:hover .fa {
width: 0;
visibility: hidden;
}
.main-menu:hover a {
padding-left: 20px;
}
<div class="area"></div>
<nav class="main-menu">
<ul>
<li><i class="fa fa-home fa-2x"></i><span class="nav-text">Dashboard</span></li>
<li class="has-subnav"><i class="fa fa-laptop fa-2x"></i><span class="nav-text">UI Components</span></li>
<li class="has-subnav"><i class="fa fa-list fa-2x"></i><span class="nav-text">Forms</span></li>
<li class="has-subnav"><i class="fa fa-folder-open fa-2x"></i><span class="nav-text">Pages</span></li>
<li><i class="fa fa-bar-chart-o fa-2x"></i><span class="nav-text">Graphs and Statistics</span></li>
<li><i class="fa fa-font fa-2x"></i><span class="nav-text">Typography and Icons</span></li>
<li><i class="fa fa-table fa-2x"></i><span class="nav-text">Tables</span></li>
<li><i class="fa fa-map-marker fa-2x"></i><span class="nav-text">Maps</span></li>
<li><i class="fa fa-info fa-2x"></i><span class="nav-text">Documentation</span></li>
</ul>
<ul class="logout">
<li><i class="fa fa-power-off fa-2x"></i><span class="nav-text">Logout</span></li>
</ul>
</nav>
Default the icon to display none and then add hover css property. Something like this,
<li>
<a href="http://justinfarrow.com">
<i class="fa fa-home fa-2x my_icon"></i>
<span class="nav-text">
Dashboard
</span>
</a>
</li>
<style>
.my_icon{
display :none;
}
.my_icon:hover{
display :visible;
}
</style>
i'm getting expended menu bar with subitems when i run my jsp file and even it is not collapsing on click mean no response from the menu bar i already tried different ways to resolve this issue but unable to resolve.
HTML
<link
href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"
rel="stylesheet">
<div class="nav-side-menu">
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
<li><a href="#"> <i class="fa fa-home fa-lg"></i>
Home
</a></li>
<li data-toggle="collapse" data-target="#products"
class="collapsed active"><a><i
class="fa fa-gift fa-lg"></i> UI Elements <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="products">
<li>CSS3 Animation</li>
<li>General</li>
<li>Buttons</li>
<li>Tabs & Accordions</li>
<li>Typography</li>
<li>FontAwesome</li>
<li>Slider</li>
<li>Panels</li>
<li>Widgets</li>
<li>Bootstrap Model</li>
</ul>
<li data-toggle="collapse" data-target="#service" class="collapsed">
<a><i class="fa fa-globe fa-lg"></i> Services <span
class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="service">
<li>New Service 1</li>
<li>New Service 2</li>
<li>New Service 3</li>
</ul>
<li data-toggle="collapse" data-target="#new" class="collapsed">
<a><i class="fa fa-bus fa-lg"></i> New <span
class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="new">
<li>New New 1</li>
<li>New New 2</li>
<li>New New 3</li>
</ul>
<li><a href="#"> <i class="fa fa-user fa-lg"></i> Profile
</a></li>
<li><a href="#"> <i class="fa fa-users fa-lg"></i> Users
</a></li>
</ul>
</div>
</div>
css for nav
CSS
.nav-side-menu {
overflow: auto;
font-family: verdana;
font-size: 12px;
font-weight: 200;
background-color: #2e353d;
position: fixed;
top: 0px;
width: 24%;
height: 100%;
color: #e1ffff;
}
.nav-side-menu .brand {
background-color: #23282e;
line-height: 50px;
display: block;
text-align: center;
font-size: 14px;
}
.nav-side-menu .toggle-btn {
display: none;
}
.nav-side-menu ul, .nav-side-menu li {
list-style: none;
padding: 0px;
margin: 0px;
line-height: 35px;
cursor: pointer;
}
.nav-side-menu ul :not(collapsed) .arrow:before, .nav-side-menu li :not(collapsed) .arrow:before
{
font-family: FontAwesome;
content: "\f078";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
float: right;
}
.nav-side-menu ul .active, .nav-side-menu li .active {
border-left: 3px solid #d19b3d;
background-color: #4f5b69;
}
.nav-side-menu ul .sub-menu li.active, .nav-side-menu li .sub-menu li.active
{
color: #d19b3d;
}
.nav-side-menu ul .sub-menu li.active a, .nav-side-menu li .sub-menu li.active a
{
color: #d19b3d;
}
.nav-side-menu ul .sub-menu li, .nav-side-menu li .sub-menu li {
background-color: #181c20;
border: none;
line-height: 28px;
border-bottom: 1px solid #23282e;
margin-left: 0px;
}
.nav-side-menu ul .sub-menu li:hover, .nav-side-menu li .sub-menu li:hover
{
background-color: #020203;
}
.nav-side-menu ul .sub-menu li:before, .nav-side-menu li .sub-menu li:before
{
font-family: FontAwesome;
content: "\f105";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
}
.nav-side-menu li {
padding-left: 0px;
border-left: 3px solid #2e353d;
border-bottom: 1px solid #23282e;
}
.nav-side-menu li a {
text-decoration: none;
color: #e1ffff;
}
.nav-side-menu li a i {
padding-left: 10px;
width: 20px;
padding-right: 20px;
}
.nav-side-menu li:hover {
border-left: 3px solid #d19b3d;
background-color: #4f5b69;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
#media ( max-width : 767px) {
.nav-side-menu {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.nav-side-menu .toggle-btn {
display: block;
cursor: pointer;
position: absolute;
right: 10px;
top: 10px;
z-index: 10 !important;
padding: 3px;
background-color: #ffffff;
color: #000;
width: 40px;
text-align: center;
}
.brand {
text-align: left !important;
font-size: 22px;
padding-left: 20px;
line-height: 50px !important;
}
}
#media ( min-width : 767px) {
.nav-side-menu .menu-list .menu-content {
display: block;
}
}
body {
margin: 0px;
padding: 0px;
}
Does anybody know what the problem is and how I can fix it?
please leave your valuable answer and comments.
Not sure whether it's correct workaround for your issue, I have added jQuery function to enable the toggle. Let me know if this helps.
$(".collapsed").click(function(){
$($(this).data("target")).toggle('slow');
});
Please find the updated Fiddle for demo.
The link of this url is not working , I am using bootstrap for dropdown.
<a data-target="#" href="washington-record-sealing/" role="button" class="dropdown-toggle" data-toggle="dropdown">
Record Sealing <i class="fa fa-angle-down"></i>
</a>
I think you looking for these.
a {
text-decoration: none;
}
a:hover {
color: #ec4445;
text-decoration: none;
}
a:active, a:hover {
outline: 0 none;
}
ul {
list-style: outside none none;
margin: 0;
padding: 0
}
.main-menu ul li {
float: left;
position: relative;
}
.main-menu ul li a {
color: #444;
display: block;
font-size: 14px;
font-weight: 600;
padding: 15px 20px;
text-transform: uppercase;
}
.main-menu > ul > li:hover > a {
color: #83cbdc;
}
.main-menu ul li::before {
background: #ddd none repeat scroll 0 0;
content: "";
height: 40px;
left: 0;
position: absolute;
top: 10px;
width: 1px;
}
.main-menu ul li ul {
background: #393939 none repeat scroll 0 0;
left: 0;
position: absolute;
width: 200px;
transition: 0.3s;
opacity: 0;
top: 160%;
visibility: hidden;
}
.main-menu ul li:hover ul {
opacity: 1;
visibility: visible;
top: 100%;
}
.main-menu ul li ul li:before {
display: none;
}
.main-menu ul li ul li {
float: none;
}
.main-menu ul li ul li a {
color: #9e9e9e;
font-weight: 400;
padding: 7px 20px;
text-transform: capitalize;
transition: 0.3s;
}
.main-menu ul li ul li:hover a {
color: #5eb4dc;
font-weight: 500;
padding-left: 30px;
}
.main-menu ul li .mega-menu {
background: #393939;
left: 0;
width: 700px;
position: absolute;
top: 160%;
transition: 0.3s;
opacity: 0;
visibility: hidden;
text-align: left;
}
.main-menu ul li:hover .mega-menu {
opacity: 1;
visibility: visible;
top: 100%;
}
.main-menu ul li .mega-menu span {
width: 33.33%;
float: left;
}
.main-menu ul li .mega-menu span a {
color: #9e9e9e;
font-weight: normal;
font-size: 13px;
margin: 0 25px;
padding: 8px 0;
text-transform: capitalize;
transition: 0.4s;
}
.main-menu ul li .mega-menu span a:hover {
color: #6cc6d6;
font-weight: 500;
padding-left: 15px;
}
.main-menu ul li .mega-menu span a.mega-title {
border-bottom: 1px solid #9e9e9e;
font-weight: 600;
margin-bottom: 10px;
margin-top: 15px;
text-transform: uppercase;
}
.main-menu ul li .mega-menu span a.mega-title:hover {
padding-left: 0;
}
<div class="main-menu-area">
<div class="container">
<div class="row">
<div class="col-md-11">
<div class="main-menu">
<nav>
<ul>
<li>home <i class="fa fa-caret-down"></i>
<ul>
<li>home version 1</li>
<li>home version 1</li>
<li>home version 1</li>
<li>home version 1</li>
<li>home version 1</li>
<li>home version 1</li>
</ul>
</li>
<li>mega menu <i class="fa fa-caret-down"></i>
<div class="mega-menu">
<span>
<a class="mega-title" href="#">Mega title</a>
Mega item 1
Mega item 2
Mega item 3
Mega item 4
Mega item 5
</span>
<span>
<a class="mega-title" href="#">Mega title</a>
Mega item 1
Mega item 2
Mega item 3
Mega item 4
Mega item 5
</span>
<span>
<a class="mega-title" href="#">Mega title</a>
Mega item 1
Mega item 2
Mega item 3
Mega item 4
Mega item 5
</span>
</div>
</li>
<li>work <i class="fa fa-caret-down"></i></li>
<li>shop <i class="fa fa-caret-down"></i></li>
<li>blog <i class="fa fa-caret-down"></i>
<ul>
<li>blog page 1</li>
<li>blog page 1</li>
<li>blog page 1</li>
<li>blog page 1</li>
<li>blog page 1</li>
</ul>
</li>
<li>contact <i class="fa fa-caret-down"></i></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
When I click on the links in the dropdown menu, it doesn't go any where. It just hided the drop down menu.
What am I doing wrong?
demo
.profile {
float: right;
margin-top: 50px;
margin-right: 20px;
}
.nav- {
/*margin: 0;
padding: 0;*/
list-style-type: none;
}
.nav- li a {
color: #f00;
}
profile .dropdown > a {
line-height: 80px;
}
.dropdown a:focus {
color: #00f;
}
.dropdown-container {
position: absolute;
top: 130px;
right: 0px;
max-height: 0;
overflow: hidden;
background: #FFFFFF;
color: #fff;
box-shadow: 0px 0px 2px #FFFFFF;
}
.dropdown a:focus ~ .dropdown-container {
max-height: 500px;
transition: max-height 0.5s ease-in;
-webkit-transition: max-height 0.5s ease-in;
-moz-transition: max-height 0.5s ease-in;
}
.dropdown-menu li a {
display: inline-block;
min-width: 200px;
padding: 15px 20px;
border-bottom: 1px solid #333333;
color: #CCCCCC;
background-color: #171717;
}
.dropdown-menu li a:hover {
color: #FFFFFF;
background: #030303;
}
<body>
<div class="profile">
<ul class="nav-">
<li class="dropdown">Dropdown Menu <i class="fa fa-angle-down"></i>
<div class="dropdown-container">
<ul class="dropdown-menu">
<li>Help <i class="fa fa-question-circle pull-right"></i>
</li>
<li>Log out <i class="fa fa-sign-out pull-right"></i>
</li>
</ul>
</div>
</li>
</ul>
</div>
</body>