Here's the code. Notice that's NOT my code.
HTML:
<div class="drop">
<ul class="drop_menu">
<li><a href='#'>Link 1</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
</ul>
</li>
<li><a href='#'>Link 2</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
<li><a href='#'>Sub Link 3</a></li>
<li><a href='#'>Sub Link 4</a></li>
</ul>
</li>
<li><a href='#'>Link 3</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
<li><a href='#'>Sub Link 3</a></li>
<li><a href='#'>Sub Link 4</a></li>
</ul>
</li>
</ul>
</div>
CSS:
.drop_menu {
background:#005555;
padding:0;
margin:0;
list-style-type:none;
height:30px;
}
.drop_menu li { float:left; }
.drop_menu li a {
padding:9px 20px;
margin-left:auto;
margin-right:auto;
display:block;
color:#fff;
text-decoration:none;
font:12px arial, verdana, sans-serif;
}
/* Submenu */
.drop_menu ul {
position:absolute;
left:-9999px;
top:-9999px;
list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#5FD367; }
.drop_menu li:hover ul {
left:0px;
top:30px;
background:#5FD367;
padding:0px;
}
.drop_menu li:hover ul li a {
padding:5px;
display:block;
width:168px;
text-indent:15px;
background-color:#5FD367;
}
.drop_menu li:hover ul li a:hover { background:#005555; }
My question is, how can I center the "Link 1", "Link 2" and "Link 3"? On the future, I'll add more "Link 4,5,6...", so I need a solution that doesn't require "almost centered", but a permanent solution.
Can you please help me?
Here's a link to JSFiddle where you can see the code working - http://jsfiddle.net/W5F3p/
My best regards
If you're not supporting IE7 and below, I'd change the float:left on the li to a display:inline-block and then add text-align:center to the parent ul.
.drop_menu {
background:#005555;
padding:0;
margin:0;
list-style-type:none;
height:30px;
text-align:center;
}
.drop_menu li { display:inline-block; }
.drop_menu li a {
padding:9px 20px;
margin-left:auto;
margin-right:auto;
display:block;
color:#fff;
text-decoration:none;
font:12px arial, verdana, sans-serif;
}
/* Submenu */
.drop_menu ul {
position:absolute;
left:-9999px;
top:-9999px;
list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#5FD367; }
.drop_menu li:hover ul {
left:0px;
top:30px;
background:#5FD367;
padding:0px;
}
.drop_menu li:hover ul li a {
padding:5px;
display:block;
width:168px;
text-indent:15px;
background-color:#5FD367;
text-align:left;
}
.drop_menu li:hover ul li a:hover { background:#005555; }
See here: http://jsfiddle.net/s6Jcx/1/
Use text align in the container tag and set the list to display inline-block:
http://jsfiddle.net/W5F3p/1/
.drop
{
text-align: center;
background:#005555;
}
A little hacky but does the trick.
Related
We were following this tutorial (http://www.script-tutorials.com/click-action-multilevel-css3-dropdown-menu/). The goal was to create a multilevel dropdown click menu with css/html and no js. The code works fine in firefox and even works in the demo shown in the tutorial in chrome, but downloading the code and using it separately doesn't work in chrome. Anyone have any ideas why? The code for the menu is:
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
<div class="example">
<ul id="nav">
<li>Home</li>
<li><a class="fly" href="#">Tutorials</a>
<ul class="dd">
<li>HTML / CSS</li>
<li><a class="fly" href="#">JS / jQuery</a>
<ul>
<li>jQuery</li>
<li>JS</li>
</ul>
</li>
<li>PHP</li>
<li>MySQL</li>
<li>XSLT</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#">Resources</a>
<ul class="dd">
<li><a class="fly" href="#">By category</a>
<ul>
<li>PHP</li>
<li>MySQL</li>
<li><a class="fly" href="#">Menu1</a>
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li><a class="fly" href="#">Menu3</a>
<ul>
<li>Menu31</li>
<li>Menu32</li>
<li>Menu33</li>
<li>Menu34</li>
</ul>
</li>
<li>Menu4</li>
</ul>
</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#">By tag name</a>
<ul>
<li>captcha</li>
<li>gallery</li>
<li>animation</li>
</ul>
</li>
</ul>
</li>
<li>About</li>
<li>Go Back To The Tutorial</li>
</ul>
</div>
/* demo page styles */
body {
background:#eee;
margin:0;
padding:0;
}
.example {
background:#fff url(../images/tech.jpg);
width:770px;
height:570px;
border:1px #000 solid;
margin:20px auto;
padding:15px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
}
/* main menu styles */
#nav,#nav ul {
background-image:url(../images/tr75.png);
list-style:none;
margin:0;
padding:0;
}
#nav {
height:41px;
padding-left:5px;
padding-top:5px;
position:relative;
z-index:2;
}
#nav ul {
left:-9999px;
position:absolute;
top:37px;
width:auto;
}
#nav ul ul {
left:-9999px;
position:absolute;
top:0;
width:auto;
}
#nav li {
float:left;
margin-right:5px;
position:relative;
}
#nav li a {
background:#c1c1bf;
color:#000;
display:block;
float:left;
font-size:16px;
padding:8px 10px;
text-decoration:none;
}
#nav > li > a {
-moz-border-radius:6px;
-webkit-border-radius:6px;
-o-border-radius:6px;
border-radius:6px;
overflow:hidden;
}
#nav li a.fly {
background:#c1c1bf url(../images/arrow.gif) no-repeat right center;
padding-right:15px;
}
#nav ul li {
margin:0;
}
#nav ul li a {
width:120px;
}
#nav ul li a.fly {
padding-right:10px;
}
/*hover styles*/
#nav li:hover > a {
background-color:#858180;
color:#fff;
}
/*focus styles*/
#nav li a:focus {
outline-width:0;
}
/*popups*/
#nav li a:active + ul.dd,#nav li a:focus + ul.dd,#nav li ul.dd:hover {
left:0;
}
#nav ul.dd li a:active + ul,#nav ul.dd li a:focus + ul,#nav ul.dd li ul:hover {
left:140px;
}
New css Worked for me in both crome and firefox!::::
body {
background:#eee;
margin:0;
padding:0;
}
.example {
background:#fff url(../images/tech.jpg);
width:770px;
height:570px;
border:1px #000 solid;
margin:20px auto;
padding:15px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
}
/* main menu styles */
#nav,#nav ul {
background-image:url(../images/tr75.png);
list-style:none;
margin:0;
padding:0;
}
#nav {
height:41px;
padding-left:5px;
padding-top:5px;
position:relative;
z-index:2;
}
#nav ul {
left:-9999px;
position:absolute;
top:37px;
width:auto;
}
#nav ul ul {
left:-9999px;
position:absolute;
top:0;
width:auto;
}
#nav li {
float:left;
margin-right:5px;
position:relative;
}
#nav li a {
background:#c1c1bf;
color:#000;
display:block;
float:left;
font-size:16px;
padding:8px 10px;
text-decoration:none;
}
#nav > li > a {
-moz-border-radius:6px;
-webkit-border-radius:6px;
-o-border-radius:6px;
border-radius:6px;
overflow:hidden;
}
#nav li a.fly {
background:#c1c1bf url(../images/arrow.gif) no-repeat right center;
padding-right:15px;
}
#nav ul li {
margin:0;
}
#nav ul li a {
width:120px;
}
#nav ul li a.fly {
padding-right:10px;
}
/*hover styles*/
#nav li:hover > a {
background-color:#858180;
color:#fff;
}
/*focus styles*/
#nav li a:focus {
outline-width:0;
}
/*popups*/
#nav li a:hover + ul.dd,#nav li a:focus + ul.dd,#nav li ul.dd:hover {
left:0;
}
#nav ul.dd li a:hover + ul,#nav ul.dd li a:focus + ul,#nav ul.dd li ul:hover {
left:140px;
}
In files for download is different html page. Difference is that live demo contain attribute tabindex="1" in some links. I downloaded source code from live example and it works in chrome now.
New code for your html page.
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
<div class="example">
<ul id="nav">
<li>Home</li>
<li><a class="fly" href="#" tabindex="1">Tutorials</a>
<ul class="dd">
<li>HTML / CSS</li>
<li><a class="fly" href="#" tabindex="1">JS / jQuery</a>
<ul>
<li>jQuery</li>
<li>JS</li>
</ul>
</li>
<li>PHP</li>
<li>MySQL</li>
<li>XSLT</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#" tabindex="1">Resources</a>
<ul class="dd">
<li><a class="fly" href="#" tabindex="1">By category</a>
<ul>
<li>PHP</li>
<li>MySQL</li>
<li><a class="fly" href="#" tabindex="1">Menu1</a>
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li><a class="fly" href="#" tabindex="1">Menu3</a>
<ul>
<li>Menu31</li>
<li>Menu32</li>
<li>Menu33</li>
<li>Menu34</li>
</ul>
</li>
<li>Menu4</li>
</ul>
</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#" tabindex="1">By tag name</a>
<ul>
<li>captcha</li>
<li>gallery</li>
<li>animation</li>
</ul>
</li>
</ul>
</li>
<li>About</li>
<li>Go Back To The Tutorial</li>
</ul>
</div>
I'm trying to get the logo centered with display: inline-block and vertical-align: center but that does not work. Would you know why and how to fix this?
Many thanks
http://jsfiddle.net/eLSbq/
<div class="header">
<div class="logo">Logo</div>
<ul class="drop_menu">
<li><a href='#'>Link 1</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
</ul>
</li>
<li><a href='#'>Link 2</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
<li><a href='#'>Sub Link 3</a></li>
<li><a href='#'>Sub Link 4</a></li>
</ul>
</li>
<li><a href='#'>Link 3</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
<li><a href='#'>Sub Link 3</a></li>
<li><a href='#'>Sub Link 4</a></li>
</ul>
</li>
</ul>
</div>
.header {
width: 100%;
background: #fff;
color: #124191;
font-weight: 300;
font-size: 28px;
height: 120px;
display: table;
position: fixed;
z-index: 999999;
opacity: 0.7;
background: aqua;
}
.logo {
display: inline-block;
vertical-align: middle;
left:0;
color: #333;
font-size: 30px;
font-weight: 800;
letter-spacing: -1px;
margin-left: 60px;
background: red;
}
.drop_menu {
padding:0;
margin:0;
list-style-type:none;
right: 0;
display: table;
z-index: 3000;
display: table-cell;
vertical-align: middle;
right: 0;
}
.drop_menu li { display: table-cell;
vertical-align: middle; float: right;}
.drop_menu li a {
padding:9px 20px;
display:block;
color:#666;
text-decoration:none;
font-size: 15px;
font-weight: 400;
text-transform: uppercase;
}
/* Submenu */
.drop_menu ul {
position:absolute;
left:-9999px;
top:-9999px;
list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#5FD367; }
.drop_menu li:hover ul {
left:0px;
top:30px;
background:#5FD367;
padding:0px;
}
.drop_menu li:hover ul li a {
padding:5px;
display:block;
width:168px;
text-indent:15px;
background-color:#5FD367;
}
.drop_menu li:hover ul li a:hover { background:#005555; }
LIVE DEMO HERE
Its working now. Take a look to my live demo
the problem is that you use at the same display:table and in the same class display:table-cell.
This is not correct.
The display:inline-block are correct for what you need, but i recommend you to use float:left instead because of the compatibility of the browser like IE 7, 8 etc..
The older browser don´t understand what display:inline-block mean and doesn´t apply the css properties.
i have change your css code add some position:relative and top values too..
Greg Your layout for the Page has some serious flaws in terms of structure and css.
I suggest you to do a quality check and remove all the redundant css.
Anyways, An vertical align for an element can be done if itself is inline and parent is td as shown http://jsfiddle.net/eLSbq/6/. Display
display: inline
for logo and parent as td cell
I have a horizontal ccs dropdown menu which isn't working in IE. the colors doesn't hover and the dropdown won't come down. It works in the other browsers like Safari, firefox etc. I have IE 10.
What have i done wrong?
Here is my HTML:
<ul class="nav">
<li><a href = '#'><img src="images/house.png"/></a></li>
<li class="menu"><a href = '#'><span>Je Studie</span></a>
<ul>
<li><a href='#'>Programma</a></li>
<li><a href='#'>Begeleiding</a></li>
<li><a href='#'>Locaties</a></li>
<li><a href='#'>Open dag</a></li>
<li><a href='#'>Toelatingseisen</a></li>
<li><a href='#'>Aanmelden</a></li>
</ul>
</li>
<li class="menu"><a href = '#'><span>Voor ouders</span></a>
<ul>
<li><a href='#'>Studiekeuzeproces</a></li>
<li><a href='#'>Studiekeuzeactiviteiten</a></li>
<li><a href='#'>Het puberbrein</a></li>
<li><a href='#'>Tips</a></li>
<li><a href='#'>Begeleiding</a></li>
</ul>
</li>
<li class="menu"><a href = '#'><span>Voor decanen</span></a>
<ul>
<li><a href='#'>Advies</a></li>
<li><a href='#'>Studiekeuzeactiviteiten</a></li>
<li><a href='#'>Decanennieuws</a></li>
</ul>
</li>
<li class="menu"><a href = '#'><span>Voor bedrijven</span></a>
<ul>
<li><a href='#'>Opleiding</a></li>
<li><a href='#'>Opdrachtstages</a></li>
<li><a href='#'>Afstudeeropdrachten</a></li>
</ul>
</li>
<li class="menu"><a href = '#'><span>Contact</span></a></li>
</ul>
and my CSS:
.nav , .nav ul {
list-style-type:none;
background:#d70047;
}
.nav {
position:relative;
height:37;
background:#d70047;
}
.nav a {display:block;
color:white;
font-family:Myriad Pro;
font-size:16px;
}
.nav li{
float:left;
margin:3px 0px 0px 0px;
padding:3px 10px;
}
.nav .menu{
padding:11px 47px 7px 47px;
margin:0px 0px 0px 0px;
}
.nav .menu:hover{
background:#e3e1e1;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.nav ul{
visibility:hidden;
top:100%;
left:0;
position:absolute;
background:#e3e1e1;
width:920px;
height:33;
}
.nav ul li a{
font-family:Myriad Pro;
font-size:15px;
color:black !important;
}
.nav .menu:hover a{
color:#1882a5;}
.nav ul li{
background:#e3e1e1;
padding:5px 50px 5px 5px;
}
.nav ul li:hover{
}
.nav ul li:hover a{
text-decoration:underline;
font:bold;
}
.nav li:hover>ul{
visibility:visible;
}
Have you tried changing your heights to px values, i.e. height: 37px; and height: 33px;? If that's it, it's possible that the other browsers are assuming that you meant px where IE might not.
Have you tried em instead of px.
I'm having problem in implementing the footer for my website.
I have taken two <ul> lists in the inner_footer as you can see in the code below. But as I zoom in, the <ul> list in the div element is not visible. It seems a float problem, but I'm not able to figure out what's wrong with it.
HTML:
<div class="grid_16">
<div class="footer">
<div class="inner_footer">
<ul>
<li>Some content</li>
</ul>
<div>
<ul>
<li><a>Link 1</a></li>
<li><a>Link 2</a></li>
<li><a>Link 3</a></li>
<li><a>Link 4</a></li>
<li><a>Link 5</a></li>
<li>Copyrights</li>
</ul>
</div>
</div>
</div>
CSS:
.footer {
height:105px;
position:relative;
top:0;
width:100%;
}
.inner_footer {
background:url(../images/layout_img/nav.jpg) 0 center repeat-x;
font-size:12px;
border-radius:4px;
position:relative;
width:inherit;
height:31px;
margin:0 auto;
}
.inner_footer ul {
margin:0;
}
.inner_footer ul li {
color:#FFF;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
.inner_footer ul li a img {
margin:2px 0 0 20px;
}
.inner_footer ul li a {
color:#FFF;
float:left;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
.inner_footer div {
float:right;
}
.inner_footer div ul li a {
color:#FFF;
float:left;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
.inner_footer div ul li {
color:#FFF;
float:left;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
I believe the problem is in your html code. You forgot to close a div element. The code should become:
<div class="grid_16">
<div class="footer">
<div class="inner_footer">
<ul>
<li>Some content</li>
</ul>
</div>
<div>
<ul>
<li><a>Link 1</a></li>
<li><a>Link 2</a></li>
<li><a>Link 3</a></li>
<li><a>Link 4</a></li>
<li><a>Link 5</a></li>
<li>Copyrights</li>
</ul>
</div>
</div>
</div>
I have a CSS manu that I am using with sub menus. I was wondering how I would go about adding a sub-submenu to it. For example, I hover over the main menu item and the submenu pops up, then I hover over the submenu item and another submenu pops up. Here is the JS Fiddle that I am using now:
http://jsfiddle.net/PrinceofVegas/Dg3yQ/4/
Here is the CSS I am using:
.menu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:18px;
font-weight:bold;
}
.menu ul{
background:#006633;
height:35px;
list-style:none;
margin:0;
padding:0;
}
.menu li{
float:left;
padding:0px;
}
.menu li a{
background:#006633 url("../images/seperator.gif") bottom right no-repeat;
color:#ffffff;
display:block;
font-weight:normal;
line-height:35px;
margin:0px;
padding:0px 25px;
text-align:center;
text-decoration:none;
}
.menu li a:hover, .menu ul li:hover a{
background: #003f20 url("../images/hover.gif") bottom center no-repeat;
color:#FFFFFF;
text-decoration:none;
}
.menu li ul{
background:#006633;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:225px;
z-index:200;
/*top:1em;
/*left:0;*/
}
.menu li:hover ul{
display:block;
}
.menu li li {
background:url('../images/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:225px;
}
.menu li:hover li a{
background:none;
}
.menu li ul a{
display:block;
height:30px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
.menu li ul a:hover, .menu li ul li:hover a{
background:#003f20 url('../images/hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
}
.menu p{
clear:left;
}
Here is the HTML i am using:
<div class="menu">
<ul>
<li><a href="#" target="_self" >Main Item 1</a></li>
<li><a href="#" target="_self" >Main Item 2</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
</ul>
</li>
<li><a href="#" target="_self" >Main Item 3</a></li>
<li><a href="#" target="_self" >Main Item 4</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
</ul>
</li>
</ul>
</div>
Here is how I would approach what you are looking for: http://jsfiddle.net/Dg3yQ/26/
I took some liberties on revising the CSS. The revised CSS reduced the code by a couple hundred characters and I believe it accomplishes what you intended. I hope this helps.
EDITED: Added a streamlined code example with comments to this answer on how these sub menus can be accomplished.
#nav {
list-style:none inside;
margin:0;
padding:0;
text-align:center;
}
#nav li {
display:block;
position:relative;
float:left;
background: #006633; /* menu background color */
}
#nav li a {
display:block;
padding:0;
text-decoration:none;
width:200px; /* this is the width of the menu items */
line-height:35px; /* this is the hieght of the menu items */
color:#ffffff; /* list item font color */
}
#nav li li a {font-size:80%;} /* smaller font size for sub menu items */
#nav li:hover {background:#003f20;} /* highlights current hovered list item and the parent list items when hovering over sub menues */
/*--- Sublist Styles ---*/
#nav ul {
position:absolute;
padding:0;
left:0;
display:none; /* hides sublists */
}
#nav li:hover ul ul {display:none;} /* hides sub-sublists */
#nav li:hover ul {display:block;} /* shows sublist on hover */
#nav li li:hover ul {
display:block; /* shows sub-sublist on hover */
margin-left:200px; /* this should be the same width as the parent list item */
margin-top:-35px; /* aligns top of sub menu with top of list item */
}
<ul id="nav">
<li>Main Item 1</li>
<li>Main Item 2
<ul>
<li>Sub Item</li>
<li>Sub Item</li>
<li>SUB SUB LIST »
<ul>
<li>Sub Sub Item 1
<li>Sub Sub Item 2
</ul>
</li>
</ul>
</li>
<li>Main Item 3</li>
</ul>
If you want to use CSS transitions (which won't work on display property), you can replace display with opacity instead. To deal with the fact that elements now take up space even when hidden, you can simply put the whole menu into a separate div that is positioned absolutely and highest in z-order (which a menu ought to be anyway). Then nothing will be in the way as the menu will be the only item in the top layer.
Here is the original example modified by me for CSS transitions:
#menu {
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:18px;
font-weight:bold;
}
#nav {
height:35px;
list-style:none;
margin:0;
padding:0;
float:left;
text-align:center;
}
#nav li {
display:inline-block;
position:relative;
float:left;
background: #006633;
}
#nav li a {
display:inline-block;
width:200px;
line-height:35px;
padding:0;
text-decoration:none;
color:#ffffff;
}
#nav li li {float:left; #006633;}
#nav li li a {
display:block;
font-size:12px;
opacity:1;
transition: opacity 1s;
}
#nav li:hover {background:#003f20;}
/*--- Sublist Styles ---*/
#nav ul {
position:absolute;
padding:0px;
left:0;
/* display:none; */
opacity:0;
transition: opacity 1s;
}
/*--- Hide Sub Sublists ---*/
#nav li:hover ul ul {
/* display:none; */
opacity:0;
transition: opacity 1s;
}
/*--- Sublevel UL's display and position on hover ---*/
#nav li:hover ul {
/* display:block; */
opacity:1;
transition: opacity 1s;
}
/* had to make the position NOT based on hover, but permanent
for the transition to work , thus moved it from POS_001 */
#nav li li ul {
margin-left:200px;
margin-top:-35px;
}
#nav li li:hover ul {
/* POS_001 */
/* display:block; */
opacity:1;
transition: opacity 1s;
}
<div id="menu">
<ul id="nav">
<li><a href="#" target="_self" >Main Item 1</a></li>
<li><a href="#" target="_self" >Main Item 2</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >SUB SUB LIST 1 >></a>
<ul>
<li><a href="#" target="_self" >Sub Sub Test Item 1</a>
<li><a href="#" target="_self" >Sub Sub Test Item 2</a>
</ul>
</li>
<li><a href="#" target="_self" >SUB SUB LIST 2 >></a>
<ul>
<li><a href="#" target="_self" >Sub Sub Test Item 3</a>
<li><a href="#" target="_self" >Sub Sub Test Item 4</a>
</ul>
</li>
</ul>
</li>
<li><a href="#" target="_self" >Main Item 3</a></li>
</ul>
</div>