I have a problem with my dropdown sub-menu. It is working fine except from the fact that when i hover mouse beneath the menu the dropdown submenu appears. i have placed z-index value to -1 and opacity to 0 but it does not do any good. Following is the code of CSS
.menu {
float:left;
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
border-left: 1px solid rgb(226, 226, 226);
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:26px 30px;
display:block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
font-size: 1.1em;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
.menu ul li:nth-child(6){
border-right: 1px solid rgb(226, 226, 226);
}
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
#navbar{
position:relative;
z-index:12;
}
.sub-menu {
width: 160%;
padding: 5px 0px;
position: absolute;
top: 100%;
left: 0px;
z-index:-1;
opacity: 0;
transition: opacity linear 0.15s;
box-shadow: 0px 2px 3px rgba(0,0,0,0.2);
background: #2e2728;
background-color:#FFF;
/*max-height:0;*/
}
.sub-menu li {
display:block;
font-size:16px;
z-index: 101;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#3e3436;
}
And the code where I used it is
<div id="navbar">
<nav class="menu">
<ul class="clearfix">
<li>Home</li>
<li>Men <span class="arrow">▼</span>
<ul class="sub-menu">
<li>OutFitters</li>
<li>Levi's</li>
<li>StoneAge</li>
<li>Zara Men</li>
<li>Cougar</li>
</ul>
</li>
<li>Women <span class="arrow">▼</span>
<ul class="sub-menu">
<li>OutFitters</li>
<li>EGO</li>
<li>Jimmy Choo</li>
<li>Origins</li>
<li>Stylo</li>
</ul>
</li>
<li>Kids <span class="arrow">▼</span>
<ul class="sub-menu">
<li>OutFitters junior</li>
<li>Bubble Gummers</li>
<li>Breakout Kids</li>
<li>Next Kids</li>
</ul>
</li>
<li>About La-Centro</li>
<li>Contact us</li>
<div class="clear"></div>
</ul>
</nav>
</div>
The code works Absolutely fine.
Try to clear Catche and try again.
.menu {
float:left;
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
border-left: 1px solid rgb(226, 226, 226);
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:26px 30px;
display:block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
font-size: 1.1em;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
.menu ul li:nth-child(6){
border-right: 1px solid rgb(226, 226, 226);
}
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
#navbar{
position:relative;
z-index:12;
}
.sub-menu {
width: 160%;
padding: 5px 0px;
position: absolute;
top: 100%;
left: 0px;
z-index:-1;
opacity: 0;
transition: opacity linear 0.15s;
box-shadow: 0px 2px 3px rgba(0,0,0,0.2);
background: #2e2728;
background-color:#FFF;
/*max-height:0;*/
}
.sub-menu li {
display:block;
font-size:16px;
z-index: 101;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#3e3436;
}
<link rel="stylesheet" href="styles.css" type="text/css" />
<div id="navbar">
<nav class="menu">
<ul class="clearfix">
<li>Home</li>
<li>Men <span class="arrow">▼</span>
<ul class="sub-menu">
<li>OutFitters</li>
<li>Levi's</li>
<li>StoneAge</li>
<li>Zara Men</li>
<li>Cougar</li>
</ul>
</li>
<li>Women <span class="arrow">▼</span>
<ul class="sub-menu">
<li>OutFitters</li>
<li>EGO</li>
<li>Jimmy Choo</li>
<li>Origins</li>
<li>Stylo</li>
</ul>
</li>
<li>Kids <span class="arrow">▼</span>
<ul class="sub-menu">
<li>OutFitters junior</li>
<li>Bubble Gummers</li>
<li>Breakout Kids</li>
<li>Next Kids</li>
</ul>
</li>
<li>About La-Centro</li>
<li>Contact us</li>
<div class="clear"></div>
</ul>
</nav>
</div>
Related
http://jsfiddle.net/aw4zgwso/
Here's what's happening at the moment and I can't seem to center the nav menu unless I add something like width:40% to .menu But that doesn't work well and will knock the text down on smaller resolution displays
.nav {
width:100%;
height:40px;
display:block;
background-color:#313131;
}
.nav_inner {
height:100%;
margin:0 auto;
position:relative;
}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
height: 40px;
line-height: 15px;
}
.nav_menu li {
float: left;
}
.nav_menu li a {
display: block;
color:#ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color:white;
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
background:#3e3436;
}
.menu {
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
color:#ffffff;
text-decoration:none;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#ffffff;
}
.menu .arrow {
font-size:12px;
line-height:0%;
color:#00AAFF;
padding-left: 5px;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:16px;
color: #ffffff;
}
.menu > ul > li > a {
padding:9px 40px;
display:inline-block;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:95%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#313131;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#191919;
}
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="clearfix">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
You can simply use text-align:center and make li inline-block like this :
.menu>ul {
text-align: center;
margin: 0;
padding: 0;
}
.menu>ul>li {
display: inline-block;
position: relative;
font-size: 16px;
color: #ffffff;
}
here is the full code
.nav {
width: 100%;
height: 40px;
display: block;
background-color: #313131;
}
.nav_inner {
height: 100%;
margin: 0 auto;
position: relative;
}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
height: 40px;
line-height: 15px;
}
.nav_menu li {
float: left;
}
.nav_menu li a {
display: block;
color: #ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color: white;
}
.clearfix:after {
display: block;
clear: both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width: 100%;
background: #3e3436;
}
.menu {
margin: 0px auto;
}
.menu li {
margin: 0px;
list-style: none;
}
.menu a {
color: #ffffff;
text-decoration: none;
}
.menu li:hover>a,
.menu .current-item>a {
text-decoration: none;
color: #ffffff;
}
.menu .arrow {
font-size: 12px;
line-height: 0%;
color: #00AAFF;
padding-left: 5px;
}
/*----- Top Level -----*/
.menu>ul {
text-align: center;
margin: 0;
padding: 0;
}
.menu>ul>li {
display: inline-block;
position: relative;
font-size: 16px;
color: #ffffff;
}
.menu>ul>li>a {
padding: 9px 40px;
display: inline-block;
}
.menu>ul>li:hover>a,
.menu>ul>.current-item>a {
background: #191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index: 1;
opacity: 1;
}
.sub-menu {
width: 160%;
padding: 5px 0px;
position: absolute;
top: 95%;
left: 0px;
z-index: -1;
opacity: 0;
transition: opacity linear 0.15s;
background: #313131;
}
.sub-menu li {
display: block;
font-size: 16px;
}
.sub-menu li a {
padding: 10px 30px;
display: block;
}
.sub-menu li a:hover,
.sub-menu .current-item a {
background: #191919;
}
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="clearfix">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
try this :
ul {
text-align: center;
}
.menu > ul > li {
float: none;
}
Set text-align: center; for parent(.menu) and display: inline-block; for children(.clearfix).
.menu {
text-align: center;
}
.clearfix {
display: inline-block;
padding:0;
}
.menu li {
bottom: 12px;
//more code...
}
.nav { width:100%; height:40px; display:block; background-color:#313131;}
.nav_inner {height:100%; margin:0 auto; position:relative;}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
height: 40px;
line-height: 15px;
}
.nav_menu li {
float: left;
}
.nav_menu li a {
display: block;
color:#ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color:white;
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
background:#3e3436;
}
.menu {
text-align: center;
}
.clearfix {
display: inline-block;
padding:0;
}
.menu li {
bottom: 12px;
list-style:none;
}
.menu a {
color:#ffffff;
text-decoration:none;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#ffffff;
}
.menu .arrow {
font-size:12px;
line-height:0%;
color:#00AAFF;
padding-left: 5px;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:16px;
color: #ffffff;
}
.menu > ul > li > a {
padding:9px 40px;
display:inline-block;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:95%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#313131;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#191919;
}
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="clearfix">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
To center the menu you just need to add this CSS to your menu. I'm diffinatly sure it's helpful for you.
.menu ul {
margin: 0 auto;
display: table;
}
.nav {
width:100%;
height:40px;
display:block;
background-color:#313131;
}
.nav_inner {
height:100%;
margin:0 auto;
position:relative;
}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
height: 40px;
line-height: 15px;
}
.nav_menu li {
float: left;
}
.nav_menu li a {
display: block;
color:#ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color:white;
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
background:#3e3436;
}
.menu {
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
color:#ffffff;
text-decoration:none;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#ffffff;
}
.menu .arrow {
font-size:12px;
line-height:0%;
color:#00AAFF;
padding-left: 5px;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:16px;
color: #ffffff;
}
.menu > ul > li > a {
padding:9px 40px;
display:inline-block;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:95%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#313131;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#191919;
}
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="clearfix">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
/HTML/
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="navs">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
.nav { width:100%;display:block; text-align:center;background-color:#313131;}
.nav_inner {height:100%; margin:0 auto; position:relative;text-align:center}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
line-height: 15px;
}
.nav_menu li {
display:inline-block;
}
.nav_menu li a {
display: block;
color:#ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color:white;
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
background:#3e3436;
}
.menu {
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
color:#ffffff;
text-decoration:none;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#ffffff;
}
.menu .arrow {
font-size:12px;
line-height:0%;
color:#00AAFF;
padding-left: 5px;
}
.navs {
float: left;
width: 100%;
}
/*----- Top Level -----*/
.menu > ul > li {
display:inline-block;
position:relative;
font-size:16px;
color: #ffffff;
}
.menu > ul > li > a {
padding:9px 40px;
display:inline-block;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:95%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#313131;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#191919;
}
Using text-align: center to horizontally center nested elements
If you declare text-align: center on the containing parent element (.menu > ul), remove any arbitrary margin or padding that may offset horizontal alignment, and remove the float rule declared on the list items (li) - you should achieve the intended result.
Note: for horizontal alignment, using text-align: center to work as expected, a few requirements should be met:
The containing parent element must be a block element (e.g:
display: block)
The nested elements you need centered should be inline-block
elements (e.g: display: inline-block)
No float rules should be declared on the nested elements you are
intending to horizontally align, float rules will negate any effort
to align elements in this way
.nav {
width:100%;
height:40px;
display:block;
background-color:#313131;
}
.nav_inner {
height:100%;
margin:0 auto;
position:relative;
}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
height: 40px;
line-height: 15px;
}
/* Additional */
.menu > ul {
margin: auto;
padding: 0px; /* remove arbitrary padding */
text-align: center;
}
/* end Additional */
.nav_menu li {
float: left;
}
.nav_menu li a {
display: block;
color:#ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color:white;
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
background:#3e3436;
}
.menu {
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
color:#ffffff;
text-decoration:none;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#ffffff;
}
.menu .arrow {
font-size:12px;
line-height:0%;
color:#00AAFF;
padding-left: 5px;
}
/*----- Top Level -----*/
.menu > ul > li {
float:none; /* remove float */
display:inline-block;
position:relative;
font-size:16px;
color: #ffffff;
}
.menu > ul > li > a {
padding:9px 40px;
display:inline-block;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:95%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#313131;
}
.sub-menu li {
display:block;
font-size:16px;
text-align: left; /* retain left text-alignment on submenu list items */
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#191919;
}
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="clearfix">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
Or... you could Just use Flex...
Using flex-box to horizontally center nested elements
By declaring display: flex on a parent element and justify-content: center you will be able to horizontally center elements. flex-box is actually great for list items specifically since it usually required specific nested children, e.g: ordered (ol) or unordered (ul) lists only accept li elements as directly nested children for valid markup, and flex-box typically has a parent-to-direct-child "dependency" (so in other words, flex-box rules work great for directly nested children, but may adversely affect other elements nested deeper in/down the DOM tree in ways you are either not anticipating or do not desire).
/* Additional */
.menu > ul {
display: flex;
padding: 0px;
margin: auto;
justify-content: center;
}
See collapsed Code Snippet below demonstrating flex-box solution
.nav {
width:100%;
height:40px;
display:block;
background-color:#313131;
}
.nav_inner {
height:100%;
margin:0 auto;
position:relative;
}
.nav_menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
height: 40px;
line-height: 15px;
}
/* Additional */
.menu > ul {
display: flex;
padding: 0px;
margin: auto;
justify-content: center;
}
/* end Additional */
.nav_menu li {
float: left;
}
.nav_menu li a {
display: block;
color:#ffffff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav_menu a:hover {
background-color: red;
color:white;
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
background:#3e3436;
}
.menu {
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
color:#ffffff;
text-decoration:none;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#ffffff;
}
.menu .arrow {
font-size:12px;
line-height:0%;
color:#00AAFF;
padding-left: 5px;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:16px;
color: #ffffff;
}
.menu > ul > li > a {
padding:9px 40px;
display:inline-block;
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#191919;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:95%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#313131;
}
.sub-menu li {
display:block;
font-size:16px;
text-align: left; /* retain left text-alignment on submenu list items */
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#191919;
}
<div class="nav">
<div class="nav_inner">
<nav class="hide-mobile menu">
<ul class="clearfix">
<li>Home</li>
<li>About us<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Our Values</li>
<li>Technology Partners</li>
</ul>
</li>
<li>IT Solutions<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Audio Visual</li>
<li><a href="backup-replication-business-continuity.html">Backup, Replication and
<li>Visitor & Entry Management</li>
</ul>
</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
Heads up! flex-box has poor or limited support for legacy browsers, so if this is going to be a concern for you, it's probably better not to use it in production.
IE <= 9 - Not Supported
IE 10,11 - Partial Support
See more: https://caniuse.com/#feat=flexbox
I'm coding a website for uni right now and it's going pretty well, with the exception of a dropdown menu issue. I've given the li property an ID of "selected" on some menu options (when the user is on the page in question), so that it changes colour to a dark pink.
However, the dropdown options underneath whatever has the li id of "selected" all turn dark pink too. When I add a closed li tag at the end of "about" in the html, the dropdown doesn't appear at all.
I'll post the relevant html and CSS as well as screenshots, hopefully someone could help me, please!
THIS is how a dropdown menu (without the id of "selected") looks normally. the links work and it goes slightly darker when i hover over, which is what i want
whereas THIS has the "selected" id. i don't want the dropdown menu this colour - JUST the "about" box
Here's all of the dropdown code:
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#ffeff8;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:"Luna";
text-transform: lowercase;
border:1px solid #ed85c4;
}
.menu a {
transition:all linear 0.15s;
color:#ed85c4;
background:#ffeff8;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#d771ae;
}
.menu .arrow {
font-size:10px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:14px;
}
.menu > ul > li > a {
padding:3px 40px;
display:inline-block;
text-shadow:0px 0px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > a {
background:#f1dae8;
}
.menu > ul > li#selected a{
color: #ffeff8;
background: #c864a1;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:100%;
padding:0px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 0px 0px rgba(0,0,0,0.2);
}
.sub-menu li {
display:block;
font-size:12px;
text-transform: lowercase;
font-kerning: auto;
}
.sub-menu li a {
padding:10px 30px;
display:block;
background: #ffeff8;
}
.sub-menu li a:hover, .sub-menu a {
background: #f1dae8;
}
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li id="selected">
about <span class="arrow">▼</span>
<ul class="sub-menu">
<li>history</li>
<li>values</li>
<li>the truck</li>
<li>produce info.</li>
</ul>
</li>
You did not select correctly the link below the #selected list item.
.menu > ul > li#selected a /*This selects all links below the selected li, including links in child list items*/
should be
.menu > ul > li#selected > a /* this selects the immediate descendent link only */
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#ffeff8;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:"Luna";
text-transform: lowercase;
border:1px solid #ed85c4;
}
.menu a {
transition:all linear 0.15s;
color:#ed85c4;
background:#ffeff8;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#d771ae;
}
.menu .arrow {
font-size:10px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:14px;
}
.menu > ul > li > a {
padding:3px 40px;
display:inline-block;
text-shadow:0px 0px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > a {
background:#f1dae8;
}
.menu > ul > li#selected >a{
color: #ffeff8;
background: #c864a1;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:100%;
padding:0px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 0px 0px rgba(0,0,0,0.2);
}
.sub-menu li {
display:block;
font-size:12px;
text-transform: lowercase;
font-kerning: auto;
}
.sub-menu li a {
padding:10px 30px;
display:block;
background: #ffeff8;
}
.sub-menu li a:hover, .sub-menu a {
background: #f1dae8;
}
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li id="selected">
about <span class="arrow">▼</span>
<ul class="sub-menu">
<li>history</li>
<li>values</li>
<li>the truck</li>
<li>produce info.</li>
</ul>
</li>
*
I don't know what I am doing wrong here so can you help me? I want to create a cascading drop-down menu and I can't see what I am doing wrong. I've tried everything. I am just out of ideas
*
HERE IS MY CODE
<style type="text/css">
body {
background:#bf5c71 url('australia1.jpg');
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#3e3436;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:'Ek Mukta';
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu,
.menu li:hover .sub-menu1{
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2728;
}
.sub-menu1 {
width:100%;
padding:0px 0px;
position:relative;
top:100%;
left:370px;
z-index:100;
opacity:50;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2758;
}
.sub-menu li,
.sub-menu1 li
{
display:block;
font-size:16px;
}
.sub-menu li a{
padding:10px 30px;
display:block;
}
.sub-menu1 li a{
padding:10px 10px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a,
.sub-menu1 li a:hover, .sub-menu1 .current-item a
{
background:#3e3436;
}
</style>
</body>
</html>
<html>
<head>
<title> Australia </title>
</head>
<body>
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>Acasa</li>
<li>Obiective turistice<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Sydney
<ul class="sub-menu1">
<li>Test
</ul>
</li>
<li>Melbourne</li>
<li>Brisbane</li>
<li>Perth</li>
</ul>
</li>
<li class="current-item">Galerie Foto</li>
<li>Video</li>
</ul>
</nav>
</div>
You can use adjacent sibling selector for more info visit this link On a CSS hover event, can I change another div's styling?
Set display:none initially to sub-menu1 class and on hover of sub-menu li a set display of adjacent sub-menu1 back to block.
Here is the code:
body {
background:#bf5c71 url('australia1.jpg');
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#3e3436;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:'Ek Mukta';
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu,
.menu li:hover .sub-menu1{
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2728;
}
.sub-menu1 {
width:100%;
padding:0px 0px;
position:relative;
top:100%;
left:370px;
z-index:100;
opacity:50;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2758;
display: none;
}
.sub-menu li,
.sub-menu1 li
{
display:block;
font-size:16px;
}
.sub-menu li a:hover, .sub-menu .current-item a,
.sub-menu1 li a:hover, .sub-menu1 .current-item a
{
background:#3e3436;
display: block;
}
.sub-menu li a:hover + .sub-menu1{
display:block;
padding:10px 10px;
}
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>Acasa</li>
<li>Obiective turistice<span class="arrow">▼</span>
<ul class="sub-menu">
<li>Sydney
<ul class="sub-menu1">
<li>Test
</ul>
</li>
<li>Melbourne</li>
<li>Brisbane</li>
<li>Perth</li>
</ul>
</li>
<li class="current-item">Galerie Foto</li>
<li>Video</li>
</ul>
</nav>
</div>
Or you can have an indentation on your submenus? It really depends on what you want. Could you give some example? Here's what I meant when I was talking about indentation :
body {
background:#bf5c71 url('australia1.jpg');
}
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#3e3436;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:'Ek Mukta';
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu,
.menu li:hover .sub-menu1{
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2728;
}
.sub-menu1 {
width:100%;
padding:0px 0px;
position:relative;
top:100%;
left:370px;
z-index:100;
opacity:50;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2758;
}
.sub-menu li,
.sub-menu1 li
{
display:block;
font-size:16px;
}
.sub-menu li a{
padding:10px 30px;
display:block;
}
.sub-menu1 li a{
padding:10px 10px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a,
.sub-menu1 li a:hover, .sub-menu1 .current-item a
{
background:#3e3436;
}
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>Acasa</li>
<li>Obiective turistice<span class="arrow">▼</span>
<ul class="sub-menu">
<li>
Sydney
<ul>
<li>Test
</ul>
</li>
<li>Melbourne</li>
<li>Brisbane</li>
<li>Perth</li>
</ul>
</li>
<li class="current-item">Galerie Foto</li>
<li>Video</li>
</ul>
</nav>
</div>
First of all,you must write 0 instead of 0px.
you must make the sub-menu1 display: none; then when mouse is on sydney the sub-menu must be display: block;
i have fixed somethings and this will be your code:
body {
background: #bf5c71;
}
.clearfix:after {
display: block;
clear: both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width: 100%;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
background: #3e3436;
}
.menu {
width: 1000px;
margin: 0 auto;
}
.menu li {
margin: 0;
list-style: none;
font-family: 'Ek Mukta';
}
.menu a {
transition: all linear 0.15s;
color: #919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration: none;
color: #be5b70;
}
.menu .arrow {
font-size: 11px;
line-height: 0;
}
/*----- Top Level -----*/
.menu > ul > li {
float: left;
display: inline-block;
position: relative;
font-size: 19px;
}
.menu > ul > li > a {
padding: 10px 40px;
display: inline-block;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background: #2e2728;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu,
.menu li:hover .sub-menu1 {
z-index: 1;
opacity: 1;
}
.sub-menu {
width: 160%;
padding: 5px 0;
position: absolute;
top: 0;
left: 0;
z-index: -1;
opacity: 0;
transition: opacity linear 0.15s;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
background: #2e2728;
}
#sydney:hover .sub-menu1 {
display: block;
}
.sub-menu1 {
width: 100%;
padding: 0;
position: relative;
top: 0;
left: 370px;
z-index: 100;
opacity: 50;
transition: opacity linear .15s;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
background: #2e2758;
display: none;
}
.sub-menu li,
.sub-menu1 li {
font-size: 16px;
}
.sub-menu li a {
padding: 10px 30px;
display: block;
}
.sub-menu li a:hover, .sub-menu .current-item a,
.sub-menu1 li a:hover, .sub-menu1 .current-item a {
background: #3e3436;
}
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>Acasa</li>
<li>Obiective turistice<span class="arrow">▼</span>
<ul class="sub-menu">
<li id="sydney">Sydney
<ul class="sub-menu1">
<li>Test</li>
</ul>
</li>
<li>Melbourne</li>
<li>Brisbane</li>
<li>Perth</li>
</ul>
</li>
<li class="current-item">Galerie Foto</li>
<li>Video</li>
</ul>
</nav>
</div>
Im making a landing page for a job and doing the navbar then i figured it out that i have to set the navbar fixed to top, after i fixed it the collapse of the second bar is just showing up when im not even hover on it. Had to add more margin to the next item to work "propertly" but is kinda ugly
.fixed-top {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
top: 0;
border-width: 0 0 1px;
}
#nav ul li a {
display: block;
padding: 7px 15px;
text-decoration: none;
font-weight: bold;
color: #FFFFFF;
}
#nav li a:hover {
color: #000000;
background-color: #fff;
}
#nav .navbar-izquierda ul {
width: 100%;
float: left;
margin: auto;
padding: 0;
list-style: none;
background-color: #434343;
box-shadow: 10px 0 10px #000000;
border-bottom: 1px solid #000000;
}
.clearfix:after {
display:block;
clear:both;
}
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#3e3436;
}
.menu {
width: auto;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:14px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
/*----- DropDown Navbar Inferior -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:100%;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition: opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2728;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:inline-block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#3e3436;
}
<div class="navbar-izquierda menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li class="active">Portatil</li>
<li>Desk</li>
<li>Workstation</li>
<li>Promotions</li>
<li>Services and Guarantees <span class="arrow">▼</span>
<ul class="sub-menu">
<li>Error 1</li>
<li>Error 2</li>
<li>Horror 3</li>
</ul>
</li>
</ul>
</nav><!-- Navegador inferior -->
</div><!-- Navegador Inferior -->
The key is to set the dropdown to visility:hidden; in the start and visility:visible; in :hover state.
.fixed-top {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
top: 0;
border-width: 0 0 1px;
}
#nav ul li a {
display: block;
padding: 7px 15px;
text-decoration: none;
font-weight: bold;
color: #FFFFFF;
}
#nav li a:hover {
color: #000000;
background-color: #fff;
}
#nav .navbar-izquierda ul {
width: 100%;
float: left;
margin: auto;
padding: 0;
list-style: none;
background-color: #434343;
box-shadow: 10px 0 10px #000000;
border-bottom: 1px solid #000000;
}
.clearfix:after {
display:block;
clear:both;
}
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#3e3436;
}
.menu {
width: auto;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:14px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#2e2728;
}
/*----- DropDown Navbar Inferior -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
visibility:visible;
}
.sub-menu {
width:100%;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition: opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2728;
visibility:hidden;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:inline-block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#3e3436;
}
<div class="navbar-izquierda menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li class="active">Portatil</li>
<li>Desk</li>
<li>Workstation</li>
<li>Promotions</li>
<li>Services and Guarantees <span class="arrow">▼</span>
<ul class="sub-menu">
<li>Error 1</li>
<li>Error 2</li>
<li>Horror 3</li>
</ul>
</li>
</ul>
</nav><!-- Navegador inferior -->
</div><!-- Navegador Inferior -->
I am having extreme dificulties to add a sub-menu to my dropdown, but I am not a pro on css. I would like to put a submenu on the part it says "10º ano" and "11º ano" in the dropdown "projects", but everything I do doesn't work ! How can I put submenus and open on the right side when cursor is placed ?
---------------------------------------Here is the HTML -------------------------
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>Sobre mim</li>
<li>Sobre o curso</li>
<li>
Projectos <span class="arrow">▼</span>
<ul class="sub-menu">
<li>10∘ Ano <span class="arrow">▶ </span> </li>
</li>
<li>11∘ Ano <span class="arrow">▶ </span>
<ul>
</ul>
</li>
</li>
</ul>
</li>
<li>Contactos</li>
</ul>
</nav>
</div>
--------------------------------------------------and here is css ----------------------------------
<style>
<!-- cor rosa #be5b70 -->
.clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0,0,0,0.2);
background:#3e3436;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:'Ek Mukta';
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#3e3436;
border-radius: 10px;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:130%;
text-align: center;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0,0,0,0.2);
background:#2e2728;
border-radius: 10px;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 7px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#3e3436;
border-radius: 10px;
}
.sub-menu li:hover > a, .menu .current-item > a {
text-decoration: none;
color:#E68268;
<!-- lalalalalalal separador-->
li.sub-menu li {
display:none;
position: absolute; left: 100%; top:0;}
li.sub-menu:hover li{
display: block;}
</style>
<!-- cor rosa #be5b70 --> .clearfix:after {
display:block;
clear:both;
}
/*----- Menu Outline -----*/
.menu-wrap {
width:100%;
box-shadow:0px 1px 3px rgba(0, 0, 0, 0.2);
background:#3e3436;
}
.menu {
width:1000px;
margin:0px auto;
}
.menu li {
margin:0px;
list-style:none;
font-family:'Ek Mukta';
}
.menu a {
transition:all linear 0.15s;
color:#919191;
}
.menu li:hover > a, .menu .current-item > a {
text-decoration:none;
color:#be5b70;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float:left;
display:inline-block;
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
text-shadow:0px 1px 0px rgba(0, 0, 0, 0.4);
}
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
background:#3e3436;
border-radius: 10px;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:130%;
text-align: center;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index: -1;
opacity:0;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0, 0, 0, 0.2);
background:#2e2728;
border-radius: 10px;
}
.sub-menu li {
display:block;
font-size:16px;
position: relative;
}
.sub-menu li a {
padding:10px 7px;
display:block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background:#3e3436;
border-radius: 10px;
}
.sub-menu li:hover a, .menu .current-item a {
text-decoration: none;
color:#E68268;
}
/* li.sub-menu li {
display:none;
position: absolute;
left: 100%;
top:0;
}
li.sub-menu:hover li {
display: block;
}*/
.sub-menu li ul {
display: none;
}
.sub-menu li:hover ul {
display: block;
width: 100%;
position: absolute;
left: 100%;
top: 0;
text-align: center;
padding:5px 0px;
transition:opacity linear 0.15s;
box-shadow:0px 2px 3px rgba(0, 0, 0, 0.2);
background:#2e2728;
border-radius: 10px;
}
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>Sobre mim</li>
<li>Sobre o curso</li>
<li><a href="#">
Projectos <span class="arrow">▼</span></a>
<ul class="sub-menu">
<li>10∘ Ano <span class="arrow">▶ </span>
<ul>
<li>1Ano </li>
<li>1Ano </li>
</ul>
</li>
<li>11∘ Ano <span class="arrow">▶ </span>
<ul>
<li>1Ano </li>
<li>1Ano </li>
</ul>
</li>
</ul>
</li>
<li>Contactos
</li>
</ul>
</nav>
</div>