CSS rotate making links unclickable unless double clicking - html

I can't seem to find the issue that is causing my links to only be clicked on the white portion. It's a "3D" button by that, I mean it is a link with CSS rotate transitions. I'm not able to find any solutions so I'm looking for some help!
Here's the codepen link.
HTML:
<nav>
<ul>
<li>Home
</li>
<li>Plans
</li>
<li>Forums
</li>
<li>Team
</li>
</ul>
</nav>
CSS
* {
box-sizing: border-box;
}
nav {
background: #e9e9e9;
margin: -1rem 0rem;
z-index: 0;
}
nav ul {
list-style: none;
}
nav ul li {
display: inline-block;
text-transform: uppercase;
font-size: 1.5rem;
letter-spacing: 0.05rem;
}
nav ul li a {
display: inline-block;
padding: 1rem;
color: #000;
text-decoration: none;
transition: transform 0.3s ease 0s;
transform-origin: 50% 0px 0px;
transform-style: preserve-3d;
}
nav ul li a.current {
color: #ffc400;
}
nav ul li a: hover {
background: #e9e9e9;
color: #000;
transform: rotateX(90deg) translateY(-22px);
}
nav ul li a::before {
position: absolute;
top: 100%;
left: 0px;
width: 100%;
padding: 4px 0px;
text-align: center;
line-height: 50px;
background: none repeat scroll 0% 0% #ffc400;
color: #FFF;
content: attr(data-hover);
transition: #ffc400 0.3s ease 0s;
transform: rotateX(-90 deg);
transform -origin: 50% 0px 0px;
}

Well the issue is that you're translating the link out of view so it cannot be clicked:
nav ul li a:hover {
background: #e9e9e9;
color: #000;
transform: rotateX(90deg) translateY(-22px);
}
The dead simple solution to this problem would be simply put an a element around the li element and change the current a element to a div, like so:
This way, the div and li elements that are being translated and rotated are surrounded by the clickable link.
<a href="#">
<li>
<div data-hover="Forums">Forums</div>
</li>
</a>
CSS:
* {
box-sizing: border-box;
}
nav {
background: #e9e9e9;
margin: -1rem 0rem;
z-index: 0;
}
nav ul {
list-style: none;
}
nav ul li {
display: inline-block;
text-transform: uppercase;
font-size: 1.5rem;
letter-spacing: 0.05rem;
}
nav ul li div {
display: inline-block;
padding: 1rem;
color: #000;
text-decoration: none;
transition: transform 0.3s ease 0s;
transform-origin: 50% 0px 0px;
transform-style: preserve-3d;
}
nav ul li div.current {
color: #ffc400;
}
nav ul li div:hover {
background: #e9e9e9;
color: #000;
transform: rotateX(90deg) translateY(-22px);
}
nav ul li div::before {
position: absolute;
top: 100%;
left: 0px;
width: 100%;
padding: 4px 0px;
text-align: center;
line-height: 50px;
background: none repeat scroll 0% 0% #ffc400;
color: #FFF;
content: attr(data-hover);
transition: #ffc400 0.3s ease 0s;
transform: rotateX(-90deg);
transform-origin: 50% 0px 0px;
}
And then adding a element styling to make everything work out:
nav ul a {
text-decoration: none;
}
Here's the updated pen.

Related

Borders transfer animation with being visible all the time

I've been wondering how could it be possible to implement transfer animation of borders (or box-shadow) from one element to another.
Here's raw example,
.item {
float: left;
width: 33.33%;
padding: 0;
text-align: center;
}
.item:hover {
box-shadow: 0 0 0 3px black;
/* border: 3px solid black; */
}
.sections {
width: 100%;
height: 100%;
margin: 0 auto;
}
ul {
list-style-type: none;
}
a:hover {
text-decoration: none;
}
a {
text-decoration: none;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="sections">
<ul>
<li class="item">Element 1
</li>
<li class="item">Element 2
</li>
<li class="item">Element 3
</li>
</ul>
</div>
</body>
</html>
In this case "borders" is box-shadow or border in .item:hover class. As you can see, borders appears and destroys on hover event, but I need borders flowing from one li element to another li element without destroying, keeping being visible all the time.
I swear I've seen such thing on several web sites, could you suggest something with this one maybe with help of javascript?
Maybe this can help you
I got this from Codepen this is not my code
* {
box-sizing: border-box;
}
body {
font: 300 100% 'Helvetica Neue', Helvetica, Arial;
}
.container {
width: 50%;
margin: 0 auto;
}
ul li {
display: inline;
text-align: center;
}
a {
display: inline-block;
width: 25%;
padding: .75rem 0;
margin: 0;
text-decoration: none;
color: #333;
}
.two:hover ~ hr {
margin-left: 25%;
}
.three:hover ~ hr {
margin-left: 50%;
}
.four:hover ~ hr {
margin-left: 75%;
}
hr {
height: .25rem;
width: 25%;
margin: 0;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
<div class="container">
<ul>
<li class="one">Uno</li><!--
--><li class="two">Dos</li><!--
--><li class="three">Tres</li><!--
--><li class="four">Quatro</li>
<hr />
</ul>
</div>
Source: https://codepen.io/rm/pen/ldhon
Hope it works for you
html {
font-family: 'Josefin Slab', 'Comfortaa', sans-serif;
font-size: 1.2em;
background: #eee;
}
ul {
position: relative;
width: 27em;
height: 2em;
margin: 100px auto;
padding: 0;
white-space: nowrap;
}
ul li {
display: inline;
text-align: center;
}
ul li a {
position: relative;
top: 0;
left: 0;
right: 25em;
bottom: 0;
display: inline-block;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: .4em .2em;
color: #222;
text-decoration: none;
text-shadow: 0 1px 0 white;
/*transition*/
-webkit-transition: width .3s,right .3s;
-moz-transition: width .3s,right .3s;
-o-transition: width .3s,right .3s;
transition: width .3s,right .3s;
}
ul li:nth-child(1) a { width: 4em; }
ul li:nth-child(2) a { width: 4em; }
ul li:nth-child(3) a { width: 4em; }
ul li:nth-child(4) a { width: 12em; }
ul li:nth-child(5) a { width: 5em; }
ul li:last-child a::after {
content: "";
position: absolute;
right: inherit;
bottom: -3px;
width: inherit;
height: 38px;
background: #ccc;
pointer-events: none;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
border: 1px solid transparent;
background: transparent;
}
ul li:nth-child(1) ~ li:last-child a {
right: 25em;
width: 4em;
}
ul li:nth-child(2):hover ~ li:last-child a {
right: 21em;
width: 4em;
}
ul li:nth-child(3):hover ~ li:last-child a {
right: 17em;
width: 4em;
}
ul li:nth-child(4):hover ~ li:last-child a {
right: 5em;
width: 12em;
}
ul li:nth-child(5):last-child:hover a {
right: 0;
width: 5em;
}
ul li:hover ~ li:last-child a::after,
ul li:last-child:hover a::after { border-color: red; }
ul li:last-child a {
min-width: 5em;
max-width: 5em;
}
ul li a:hover,
ul li a:focus {
color: red;
/*transition*/
-webkit-transition: width .3s,right .3s,background-color .3s;
-moz-transition: width .3s,right .3s,background-color .3s;
-o-transition: width .3s,right .3s,background-color .3s;
transition: width .3s,right .3s,background-color .3s;
}
ul li a:focus { border-bottom: 3px solid #c351fa; }
<ul>
<li>Home </li><!--
--><li> Lorem </li><!--
--><li> Ipsum </li><!--
--><li> Lorem dummy text</li><!--
--><li> Sit amet </li>
</ul>
We can use a pseudo element on the last li a element to show a border as CSS lets us select the last sibling element when any element in the list is hovered.
We can then set the border color and set the right position of this pseudo element and have it transition to the hovered li a element position.
It is possible to have a fairly general solution - setting a CSS variable to the number of elements in the list (and the transition time too if wanted) and (almost) everything else falls into place using CSS calc.
However, unfortunately, although CSS has the ability in theory to let you use the n value (in nth-child(n)) this only seems to work for pseudo element content at the moment so we can't use it to do calculations.
I have therefore put in a set of nth child settings in the CSS - currently there are 6 so you can have a list of up to 6 without changing anything except for --n. If you want more then add more.
Here's the snippet.
.sections ul {
--n: 3; /* the number of items in the list */
--t: 1s; /* the time taken to move to the new hover position */
--w: calc(100% / var(--n));
box-sizing: border-box;
padding: 20px 0;
margin: 0;
}
/* below is the original CSS */
.item {
float: left;
width: var(--w);
padding: 0;
text-align: center;
}
.item a {
text-align: center;
}
.sections {
width: 100%;
height: 100%;
margin: 0 auto;
}
ul {
list-style-type: none;
}
a:hover {
text-decoration: none;
}
a {
text-decoration: none;
}
/* end of the original CSS */
ul li:last-child a::after {
position: absolute;
content: '';
right: inherit;
width: var(--w);
height:1.5em;
transform: translateY(-0.3em);
pointer-events: none;
transition: right var(--t) ease;
}
ul li:nth-child(1):hover ~ li:last-child a {
right: calc(var(--w) * calc(var(--n) - 1));
}
ul li:nth-child(2):hover ~ li:last-child a { /*when you hover on the second element it changes the last element's a width and its position */
right: calc(var(--w) * calc(var(--n) - 2));
}
ul li:nth-child(3):hover a {
right: calc(var(--w) * calc(var(--n) - 3));
}
ul li:nth-child(4):hover a {
right: calc(var(--w) * calc(var(--n) - 4));
}
ul li:nth-child(5):hover a {
right: calc(var(--w) * calc(var(--n) - 5));
}
ul li:nth-child(6):hover a {
right: calc(var(--w) * calc(var(--n) - 6));
}
ul li:hover ~ li:last-child a::after,
ul li:last-child:hover a::after {
border: 2px solid black;
}
ul li a {
width: 100%;
}
<div class="sections">
<ul>
<li class="item">Element 1
</li>
<li class="item">Element 2
</li>
<li class="item">Element 3
</li>
</ul>
</div>

Making navbar link filled while on current page

I am currently trying to create a navbar that fills when hovered over a link. However, I would also like to have the link filled (or highlighted) while on the relative page. Any help would be much appreciated!
Note: This code has been retrieved from an open source.I am new learner of web technologies and working for a web project.
/*NAVIGATION */
body {
font-family: 'Roboto', sans-serif;
padding: 0;
margin: 0;
}
small {
font-size: 12px;
color: rgba(0, 0, 0, 0.4);
}
h1 {
text-align: center;
padding: 50px 0;
font-weight: 800;
margin: 0;
letter-spacing: -1px;
color: inherit;
font-size: 40px;
}
h2 {
text-align: center;
font-size: 30px;
margin: 0;
font-weight: 300;
color: inherit;
padding: 50px;
}
.center {
text-align: center;
}
section {
height: 100vh;
}
nav {
width: 60%;
margin: 0 auto;
background: #fff;
padding: 10px 0;
box-shadow: 0px 5px 0px #dedede;
}
nav ul {
list-style: none;
text-align: center;
}
nav ul li {
display: inline-block;
}
nav ul li a {
display: block;
padding: 15px;
text-decoration: none;
color: #aaa;
font-weight: 800;
text-transform: uppercase;
margin: 0 10px;
}
nav ul li a,
nav ul li a:after,
nav ul li a:before {
transition: all .5s;
}
nav ul li a:hover {
color: #555;
}
/* stroke */
nav.stroke ul li a,
nav.fill ul li a {
position: relative;
}
nav.stroke ul li a:after,
nav.fill ul li a:after {
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 0%;
content: '.';
color: transparent;
background: #aaa;
height: 1px;
}
nav.stroke ul li a:hover:after {
width: 100%;
}
nav.fill ul li a {
transition: all 2s;
}
nav.fill ul li a:after {
text-align: left;
content: '.';
margin: 0;
opacity: 0;
}
nav.fill ul li a:hover {
color: #fff;
z-index: 1;
}
nav.fill ul li a:hover:after {
z-index: -10;
animation: fill 1s forwards;
-webkit-animation: fill 1s forwards;
-moz-animation: fill 1s forwards;
opacity: 1;
}
/* Keyframes */
#-webkit-keyframes fill {
0% {
width: 0%;
height: 1px;
}
50% {
width: 100%;
height: 1px;
}
100% {
width: 100%;
height: 100%;
background: #333;
}
}
<section style="background: #2ecc71; color: rgba(0, 0, 0, 0.5);">
<h2>Nav bar test</h2>
<nav class="fill">
<ul>
<li>Home
</li>
<li>About
</li>
<li>Downloads
</li>
<li>More
</li>
<li>Contact
</li>
</ul>
</nav>
</section>
The best practice is just to add an "active" class to the current page button.
<li>Home</li>
And add "a.active" to every "a:hover" that you already have so it has the same css.
nav.fill ul li a:hover,
nav.fill ul li a.active { /* Here */
color: #fff;
z-index: 1;
}
nav.fill ul li a:hover:after,
nav.fill ul li a.active:after { /* Here */
z-index: -10;
animation: fill 1s forwards;
-webkit-animation: fill 1s forwards;
-moz-animation: fill 1s forwards;
opacity: 1;
}
nav.stroke ul li a:hover:after,
nav.stroke ul li a.active:after { /* Here */
width: 100%;
}
Here is an jsfiddle live example: https://jsfiddle.net/884o5sjs/
(To get help faster, remember to create your own jsfiddle next time)
You could add the class="active" to the current page dynamically with php (suggested) or even with jQuery (not suggested), but since it looks like you are using ".html" you will have to add it manually on each page.
Hope this helps.
Looks like you've already achieved your first task of having it highlight when hovered. I would do this in php because that's the language I'm most comfortable, but then you'd also have to run a web server on your computer so hopefully you get some more helpful tips from some of the Jscript pros on here. If you do have to resort to php, one way I commonly do this is by having a variable on the page that lets the header know what page you're on, and then a few if statements that coorespond and apply a .current-page style.
I'm probably doing it the long way, but I just haven't learned Javascript yet.
the if statement would look like this within the li of the ul of the nav... <li <?php if ($title == "Home) { echo "class='current-page'"; } ?>>Home and so on for each element in the ul with the corresponding title, and title declarations in the body of the page.

DropDown-Menu should stay opend after onClick

My Homepage-Menu-Point "Software" should stay opened if you click on it!
See on my Test-Homepage!
I've tested to add "li:focus" and "li:active" to my lowermost CSS-Tag, but nothing worked. I also tried it with jQuery, without success!
The HTML-Code:
<nav id="cNav">
<div class="Nav">
<ul>
<li>G</li>
<li>Home</li>
<li>Software
<ul>
<li>Android</li>
<li>Windows</li>
</ul>
</li>
<li>Über</li>
</ul>
</div>
</nav>
The CSS-Code:
#cNav {
background-color: rgb(5, 90, 160);
margin: 0;
padding: 0;
width: 100%;
}
.Nav {
font-weight: bold;
font-size: 22pt;
margin: 0;
padding: 0;
}
.Nav ul {
padding: 0;
margin-top: 0;
margin-bottom: 0;
position: relative;
width: 100%;
text-align: center;
}
.Nav ul li {
display: inline-block;
position: relative;
padding-left: 2em;
padding-right: 2em;
padding-top: 0.4em;
padding-bottom: 0.4em;
}
.Nav ul li a {
outline: 0;
color: white;
position: relative;
text-decoration: none;
transition: color 0.3s;
}
.Nav ul li a::after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 4px;
background: white;
content: '';
opacity: 0;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: opacity 0.3s, -moz-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(10px);
-moz-transform: translateY(10px);
transform: translateY(10px);
margin: 0;
}
.Nav ul li a:hover::after {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
transform: translateY(0px);
}
.Nav ul ul {
display: none;
white-space: nowrap;
position: absolute;
text-align: center;
top: 100%;
margin-left: -5.3em;
}
.Nav ul ul li {
background-color: rgb(5, 90, 160);
border-top: medium solid rgba(0,115,209,1.00);
margin-right: -1em;
}
.Nav ul li:hover > ul {
display: block;
}
If you want your Homepage-Menu-Point "Software" staying opened if you click on it, and you want to use jQuery, this might be a possible solution:
Add an id to the li with software:
<li id="software">Software
Then you can use this to set the css display property of the ul to block:
$(document).ready(function() {
$("#software ul").click(function() {
$(this).css("display", "block");
});
});
Snippet:
$(document).ready(function() {
$("#software ul").click(function() {
$(this).css("display", "block");
});
});
#cNav {
background-color: rgb(5, 90, 160);
margin: 0;
padding: 0;
width: 100%;
}
.Nav {
font-weight: bold;
font-size: 22pt;
margin: 0;
padding: 0;
}
.Nav ul {
padding: 0;
margin-top: 0;
margin-bottom: 0;
position: relative;
width: 100%;
text-align: center;
}
.Nav ul li {
display: inline-block;
position: relative;
padding-left: 2em;
padding-right: 2em;
padding-top: 0.4em;
padding-bottom: 0.4em;
}
.Nav ul li a {
outline: 0;
color: white;
position: relative;
text-decoration: none;
transition: color 0.3s;
}
.Nav ul li a::after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 4px;
background: white;
content: '';
opacity: 0;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: opacity 0.3s, -moz-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(10px);
-moz-transform: translateY(10px);
transform: translateY(10px);
margin: 0;
}
.Nav ul li a:hover::after {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
transform: translateY(0px);
}
.Nav ul ul {
display: none;
white-space: nowrap;
position: absolute;
text-align: center;
top: 100%;
margin-left: -5.3em;
}
.Nav ul ul li {
background-color: rgb(5, 90, 160);
border-top: medium solid rgba(0,115,209,1.00);
margin-right: -1em;
}
.Nav ul li:hover > ul {
display: block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<nav id="cNav">
<div class="Nav">
<ul>
<li>G</li>
<li>Home</li>
<li id="software">Software
<ul>
<li>Android</li>
<li>Windows</li>
</ul>
</li>
<li>Über</li>
</ul>
</div>
</nav>

Max height of ul is limited to a single nested li item

Making a slide down drop menu animation, if I set max height to 100% the <ul> will only extend its height to the first nested <li>. I can set the max-height in the Keyframe to 400%, but this causes to animation to go twice as fast in other drop downs with less submenus. The height of the <ul> before I hover over seems to be the full size when debugging, not sure why it gets limited in the animation.
And as a secondary question, will I run into browser support issues using animations like this?
JSFiddle
#keyframes slideDown {
0% {
max-height: 0%;
opacity: .2;
}
100% {
max-height: 400%;
opacity: 1;
}
}
#menuTabs {
float: left;
position: absolute;
margin-left: 0px;
background: #256AAA none repeat scroll 0% 0%;
width: 100%;
overflow: visible;
}
#menuTabs ul {
left: 50%;
margin: 0px;
clear: left;
float: left;
padding: 0px;
font-size: 15px;
position: relative;
text-align: center;
font-family: helvetica;
list-style: outside none none;
}
#menuTabs ul li {
margin:0;
padding:0;
right:50%;
float:left;
display:block;
list-style:none;
min-width: 170px;
max-width: 170px;
position:relative;
}
#menuTabs ul li a {
color:#000;
display:block;
background:#ddd;
padding:0px 50px;
line-height:1.3em;
text-decoration:none;
font-family:'Oxygen', sans-serif;
color: #FFF;
margin-top: 0px;
font-weight: bold;
padding: 15px 50px;
text-decoration: none;
background: #Blue;
}
#menuTabs ul li:hover > a {
visibility: visible;
text-decoration: none;
background: #CCC;
}
ul#menu li.selected a {
color: #000;
background-color: #fff;
}
#menuTabs ul li ul {
margin: 0;
padding: 0;
width: 100%;
visibility: hidden;
overflow: hidden;
position: absolute;
left: 0%;
max-height: 0%;
}
#menuTabs ul li ul a {
z-index: 1;
display: block;
font-size: 12px;
max-width: 70px;
min-width: 120px;
min-height: 22px;
overflow: visible;
position: relative;
padding: 14px 25px;
background: #256AAA none repeat scroll 0% 0%;
}
#menuTabs ul li ul a:hover {
background: #CCC;
}
#menuTabs ul li:hover ul {
visibility: visible;
position: absolute;
background: #CCC;
}
#menuTabs ul li:hover ul {
max-height: 0%;
animation-name: slideDown;
animation-duration: 2s;
animation-fill-mode: forwards;
}
#menuTabs ul li ul li {
left: 0%;
display: block;
}
<div id="menuTabs">
<ul id="menu">
<li> Services
<ul id="class">
<li id="srv1"> SubMenu
</li>
<li id="srv2"> SubMenu2
</li>
</ul>
<li>Resources
<ul>
<li> SubMenu2</li>
<li> SubMenu3</li>
<li> SubMenu4</li>
<li> SubMenu5</li>
</ul>
</li>
</li>
</ul>
</div>
I would do it by just using transition instead of keyframes for that, it runs smoother, and much easier. I haven't found a way to do the dynamic height thing, so I think you'll have to pick a height with the max number of items you're possibility going to have.
jsfiddle
#menuTabs ul li ul {
...
max-height: 0;
transition: all .1s ease-out;
opacity: .5;
}
#menuTabs ul li:hover ul {
...
max-height: 400%;
transition: all .25s ease-in;
opacity: 1;
}

CSS multilvel menu issue at third level

I've made a three level menu in HTML and CSS.
The menu works until the third level (under products). The third ul sub-menu isn't displaying properly. It's being aligned improperly. I want it to get out of it's parent menu and be positioned at the right.
Here is a jsfiddle with my code.
I've changed some postions of ul, li but they don't seem to be working for me.
CSS, HTML in the fiddle:
#nav,#nav ul {
list-style: none outside none;
margin: 0;
padding: 0;
}
#menucon {
width:100%;
background-color:#222;
}
#nav {
clear: both;
font-size: 12px;
height: 42px;
}
#nav ul {
background-color: #222;
background-color: rgba(34,34,34,0.70);
border:1px solid #222;
border-radius: 0 5px 5px 5px;
border-width: 0 1px 1px;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
left: -9999px;
overflow: hidden;
position: absolute;
top: -9999px;
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-o-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
#nav ul.sec { z-index: 2; }
#nav ul.third { z-index: 3; border:2px solid red; }
#nav li {
background: url('menu_line.png') no-repeat scroll right 5px transparent;
float: left;
position: relative;
}
#nav li a {
color: #FFFFFF;
display: block;
float: left;
font-weight: normal;
height: 27px;
padding: 14px 30px 0;
position: relative;
text-decoration: none;
text-shadow: 1px 1px 1px #000000;
}
#nav ul.subs li a {
color: #FFFFFF;
display: block;
float: left;
font-weight: normal;
height: 27px;
padding: 13px 25px 0;
position: relative;
width:178px;
text-decoration: none;
text-shadow: 1px 1px 1px #000000;
}
#nav li:hover > a {
color: #00B4FF;
}
#nav li:hover, #nav a:focus, #nav a:hover, #nav a:active {
background: none repeat scroll 0 0 #121212;
outline: 0 none;
}
#nav li:hover ul.subs.sec {
left: 0;
top: 41px;
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-o-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
position:absolute;
}
#nav li:hover ul.subs.third {
left: 60px; /* test */
top: 41px;
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-o-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
position:absolute;
}
#nav ul li {
background: none;
width: 100%;
}
#nav ul li.sec {position:relative;}
#nav ul li a {
float: none;
}
#nav ul li:hover > a {
background-color: #121212;
color: #00B4FF;
}
#lavalamp {
background: url('lavalamp.png') no-repeat scroll 0 0 transparent;
height: 16px;
left: 32px;
position: absolute;
top: 0px;
width: 64px;
-moz-transition: all 400ms ease-out ;
-ms-transition: all 400ms ease-out ;
-o-transition: all 400ms ease-out ;
-webkit-transition: all 400ms ease-out ;
transition: all 400ms ease-out ;
}
#lavalamp:hover {
-moz-transition-duration: 4500s;
-ms-transition-duration: 4500s;
-o-transition-duration: 4500s;
-webkit-transition-duration: 4500s;
transition-duration: 4500s;
}
#nav li:nth-of-type(1):hover ~ #lavalamp, #lavalamp.act1 {
left: 35px;
}
#nav li:nth-of-type(2):hover ~ #lavalamp, #lavalamp.act2 {
left: 180px;
}
#nav li:nth-of-type(3):hover ~ #lavalamp, #lavalamp.act3{
left: 345px;
}
#nav li:nth-of-type(4):hover ~ #lavalamp, #lavalamp.act4 {
left: 486px;
}
#nav li:nth-of-type(5):hover ~ #lavalamp, #lavalamp.act5 {
left: 620px;
}
<div id="menucon">
<ul class="innercon" id="nav">
<li>HOME PAGE</li>
<li>PRODUCTS
<ul class="subs sec">
<li class="sec">LEVEL 1
<ul class="subs third">
<li>LEVEL 2</li>
<li>LEVEL 2</li>
</ul>
</li>
<li>LEVEL 1</li>
<li>LEVEL 1</li>
<li>LEVEL 1</li>
<li>LEVEL 1</li>
<li>LEVEL 1</li>
</ul>
</li>
<li>CONTACT US</li>
<div id="lavalamp"></div>
</ul>
</div>
Here is a DEMO to try if it fits your problem.
You gonna have to add this just this css:
.third{
display: none;
}
li > ul.sec > li:hover > ul.third {
display: inline-block;
position: absolute;
left: 100%!important;
top: 0!important;
z-index: 9;
width: 150px;
}
Explanation:
when you hover your second level item (li) you will show your submenu 100% left, i.e. next to the hovered li and top: 0 will place it inline with the hovered li.
You can adjust the width and z-index for your needs.
is this what you wanted?
Your question is still kinda unclear what you want.
ul.sec {
overflow: visible !important;
}
.subs .third {
left: 228px !important;
top: 41px !important;
}
https://jsfiddle.net/gsw4jxy8/4/