So i ve been working on this for several hours.. i have a problem in the nav bar where the content refuses to go display: inline. Previous versions worked fine but were too disorganized , code wise. here is my code.
CSS:
body {
background-color: #5C7584;
margin: 0 auto;
//width: 1000px;
width: 100%;
margin-top: 10px;
}
#canvas {
width: 1000px;
margin: 0 auto;
background-color: white;
}
a {
color: #4086b6;
text-decoration: none;
}
///////////////////////////////////
ul, li {
list-style: none;
}
ul li {
//padding-right: 10px;
//padding-left: 10px;
//display: inline;
}
.parentClass {
display: inline;
//position: relative;
list-style: none;
//float: left;
}
.dropDown {
position: relative;
background-color: lightcyan;
display: block;
list-style: inherit;
//text-align: right;
//background-color: lightcyan;
width: auto;
height: 0px;
visibility: hidden;
opacity: 0;
-webkit-transition: all .25s;
-moz-transition: all .25s;
-ms-transition: all .25s;
-o-transition: all .25s;
transition: all .5s;
}
#linkline{
}
.parentClass:hover {
background-color: lightcyan;
}
.parentClass:hover .dropdown {
opacity: 1;
visibility: visible;
height: auto;
}
/////////////////////////////
#toplinks a {
//padding-left: 0px;
text-shadow: 1px 1px lightgrey;
}
#toplinks a:hover {
color: lightskyblue;
//border-radius: 50px 50px;
}
#toplinks a:active {
color: white;
}
#top {
height: 102px;
background-image: url("../assets/topbar_plain.png");
background-color: white;
opacity: .9;
z-index: 2;
position: relative;
}
#toplinks {
float: right;
width: 500px;
text-align: right;
padding-right: 30px;
padding-top: 70px;
}
#logo {
background-image: url("../assets/logo_plain.png");
width: 102px;
height: 33px;
float: left;
background-repeat: no-repeat;
margin-top: 40px;
margin-left: 80px;
}
HTML:
<div id="top" >
<div id="canvas">
<div id="toplinks">
<ul class="linkline">
<li id="indexx" class="parentClass">Overview
<ul></ul>
</li>
<li class="parentClass">Services
<ul class="dropDown">
<li class="c2"> DDoS Mitigation </li>
<li class="c1"> Server Hosting </li>
</ul>
</li>
<li class="parentClass">AboutUs
<ul class="dropDown">
<li class="c2"> Link 1 </li>
<li class="c1"> Link 2 </li>
<li class="c2"> Link 3 </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
Try with:
display:inline-block
ul {
list-style: none;
}
li {
float: left;
display: block;
margin: 0 1em 0 0;
border: 1px solid purple;
}
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
</ul>
Hi, I simplified your code down to the lists and their styling which is what you need to fix. Make sure ul is list-style none and the li's in that list are float left display block and then style from there.
It looks like something strange is happening because of the <ul class="dropDown"> nested inside the <li class="parentClass">. Try this as a start:
.dropDown {
display: none;
}
.parentClass {
display: inline-block;
}
Try to change the parentClass like that.
.parentClass {
display: inline-block;
position: relative;
list-style: none;
float: left;
}
Related
I am trying to make a drop-down with three levels. But when I hover the first level, the second one appears a little over the first level and on the left side. I want to have the second level in the middle of the first level. And I don't know how can I have a third level in the right side of the second level.
.middle,
.bottom {
background-color: #1565c0;
width: 100%;
overflow: hidden;
}
.middle ul.top-level-menu li:after,
.bottom ul.top-level-menu li:after {
height: 3px;
width: 0px;
content: '';
display: block;
margin: auto;
background: transparent;
transition: width 0.5s ease, background-color 0.5s ease;
}
.middle ul.top-level-menu li:hover:after,
.bottom ul.top-level-menu li:hover:after {
width: 100%;
background: #003c8f;
}
.middle ul.top-level-menu,
.bottom ul.top-level-menu {
padding: 0;
margin: 0;
list-style-type: none;
}
.middle ul.top-level-menu>li,
.bottom ul.top-level-menu>li {
width: 25%;
padding: 10px;
float: left;
text-align: center;
text-align: -webkit-center;
text-align: -moz-center;
z-index: 1;
}
.middle ul.top-level-menu>li:hover,
.bottom ul.top-level-menu>li:hover {
cursor: hand;
}
.middle ul.top-level-menu>li:hover>ul.second-level-menu,
.bottom ul.top-level-menu>li:hover>ul.second-level-menu {
display: block;
position: absolute;
padding: 10px 14px;
list-style-type: none;
}
.middle ul.top-level-menu a,
.bottom ul.top-level-menu a {
font-family: 'Kanit', sans-serif;
font-size: 17px;
color: #fff;
text-decoration: none;
}
.middle ul.top-level-menu li ul.second-level-menu,
.bottom ul.top-level-menu li ul.second-level-menu {
display: none;
background-color: #1565c0;
z-index: 1;
emphasized text border-top: 5px solid #f00;
}
.middle ul.top-level-menu li ul.second-level-menu li ul.third-level-menu,
.bottom ul.top-level-menu li ul.second-level-menu li ul.third-level-menu {
display: none;
z-index: 1;
}
<nav role="navigation">
<div class="middle">
<ul class="top-level-menu">
<li>
Acerca
<ul class="second-level-menu">
<li>Historia</li>
<li>Misión y Visión</li>
<li>Organigrama</li>
</ul>
</li>
<li>
Carreras
<ul class="second-level-menu">
<li>Enfermería</li>
<li>Informática</li>
<li>Gastronomía
<li>
<li>Contabilidad</li>
</ul>
</li>
<li>
Admisión
<ul class="second-level-menu">
<li>Chicago</li>
<li>Los Angeles</li>
<li>
New York
<ul class="third-level-menu">
<li>Information</li>
<li>Book a Meeting</li>
<li>Testimonials</li>
<li>Jobs</li>
</ul>
</li>
<li>Seattle</li>
</ul>
</li>
<li>Calendario</li>
</ul>
</div>
</nav>
Here a little picture of the output:
I have updated your code below - I have added many small changes.
Some notes to remember:
1). An absolute element (almost always) should have a parent which is "relative". Your child "ul" containers were set to absolute, but the parent "li" elements were not set to "position: relative", hence the "ul"-s could not be positioned properly.
2). In order to position your 2nd level to center I gave it a width: 70%, 10% from left and right, 5% padding for left and right.
.middle,
.bottom {
background-color: #1565c0;
width: 100%;
display: table;
}
.middle ul.top-level-menu li:after,
.bottom ul.top-level-menu li:after {
height: 3px;
width: 0px;
content: '';
display: block;
margin: auto;
background: transparent;
transition: width 0.5s ease, background-color 0.5s ease;
}
.middle ul.top-level-menu li:hover:after,
.bottom ul.top-level-menu li:hover:after {
width: 100%;
background: #003c8f;
}
.middle ul.top-level-menu,
.bottom ul.top-level-menu {
padding: 0;
margin: 0;
list-style-type: none;
}
.middle ul.top-level-menu>li,
.bottom ul.top-level-menu>li {
width: 23%;
padding: 10px 1%;
float: left;
text-align: center;
text-align: -webkit-center;
text-align: -moz-center;
position: relative;
}
.middle ul.top-level-menu>li:hover,
.bottom ul.top-level-menu>li:hover {
cursor: hand;
}
.middle ul.top-level-menu a,
.bottom ul.top-level-menu a {
font-family: 'Kanit', sans-serif;
font-size: 17px;
color: #fff;
text-decoration: none;
}
.middle ul.top-level-menu li ul.second-level-menu,
.bottom ul.top-level-menu li ul.second-level-menu {
display: none;
background-color: #1565c0;
border-top: 5px solid #f00;
}
.middle ul.top-level-menu>li:hover>ul.second-level-menu,
.bottom ul.top-level-menu>li:hover>ul.second-level-menu {
display: table;
position: absolute;
left: 10%;
width: 70%;
padding: 10px 5%;
list-style-type: none;
background: #333;
z-index: 2;
}
.middle ul.top-level-menu li ul.second-level-menu li,
.bottom ul.top-level-menu li ul.second-level-menu li{
position: relative;
}
.middle ul.top-level-menu li ul.second-level-menu li ul.third-level-menu,
.bottom ul.top-level-menu li ul.second-level-menu li ul.third-level-menu {
display: none;
z-index: 1;
}
.middle ul.top-level-menu li ul.second-level-menu li:hover > ul.third-level-menu,
.bottom ul.top-level-menu li ul.second-level-menu li:hover > ul.third-level-menu {
display: block;
z-index: 1;
position: absolute;
left: 95%;
background: red;
text-align: left;
list-style: none;
padding: 10px 14px;
top: 0px;
}
<nav role="navigation">
<div class="middle">
<ul class="top-level-menu">
<li>
Acerca
<ul class="second-level-menu">
<li>Historia</li>
<li>Misión y Visión</li>
<li>Organigrama</li>
</ul>
</li>
<li>
Carreras
<ul class="second-level-menu">
<li>Enfermería</li>
<li>Informática</li>
<li>Gastronomía
<li>
<li>Contabilidad</li>
</ul>
</li>
<li>
Admisión
<ul class="second-level-menu">
<li>Chicago</li>
<li>Los Angeles</li>
<li>
New York
<ul class="third-level-menu">
<li>Information</li>
<li>Book a Meeting</li>
<li>Testimonials</li>
<li>Jobs</li>
</ul>
</li>
<li>Seattle</li>
</ul>
</li>
<li>Calendario</li>
</ul>
</div>
</nav>
I'm having trouble writing a code for a simple drop down menu but cant understand what I'm doing wrong still new to coding. Whenever I bring my cursor over the respective dropdown li tag the hover color effect is there but nothing comes down. In a previous attempt when the code was a a little different the list id appeared but it was in an inline manner and was align horizontally not vertically plz help.
#navbar {
background-color: #9C9C9C;
margin: 0px 200px 0px 200px;
height: 30px;
overflow: hidden;
}
#nav {
padding: 0px;
margin: 0px;
font-family: arial;
}
#main {
display: inline;
}
a {
display: block;
text-align: center;
float: left;
width: 100px;
padding: 3px;
line-height: 25px;
text-decoration: none;
color: white;
margin-top: 0px;
}
a:hover {
background-color: #d3d3d3;
color: black;
}
ul li ul li {
display: none;
}
ul li:hover ul li {
display block;
}
#searchbar {
margin: 5px 5px 0px 0px;
float: right;
}
<div id="navbar">
<div>
<ul id="nav">
<li id="main">Home</li>
<li id="main">Products</li>
<li id="main">More
<ul class="c">
<li class="B"><a id="A">Article1</a></li>
<li class="B"><a id="A">Article2</a></li>
<li class="B"><a id="A">Article3</a></li>
<li class="B"><a id="A">Article4</a></li>
</ul>
</li>
<li id="main">About US</li>
</ul>
</div>
<div id="searchbar"><input type="text" name="search" /><button id="button">GO</button></div>
</div>
First of all, you have id="main" applied to multiple elements. id is meant to be unique and applied to only one element.
Second, your hover effect was just a little incomplete. See my changes below.
#navbar {
background-color: #9C9C9C;
margin: 0px 200px 0px 200px;
height: 30px;
/*overflow: hidden; don't do this if you want dropdowns */
}
#nav {
padding: 0px;
margin: 0px;
font-family: arial;
}
#main {
display: inline;
}
#nav>li>a {
display: block;
text-align: center;
float: left;
width: 100px;
padding: 3px;
line-height: 25px;
text-decoration: none;
color: white;
margin-top: 0px;
}
#nav>li>a:hover {
background-color: #d3d3d3;
color: black;
}
#nav>li {
position: relative;
display: inline-block;
}
#nav>li ul {
display: none;
position: absolute;
}
#nav>li:hover ul {
display: block;
bottom: -80px;
padding: 10px;
left: 0;
min-width: 100px;
}
#searchbar {
margin: 5px 5px 0px 0px;
float: right;
}
<div id="navbar">
<div>
<ul id="nav">
<li>Home</li>
<li>Products</li>
<li>More
<ul class="c">
<li class="B"><a id="A">Article1</a></li>
<li class="B"><a id="A">Article2</a></li>
<li class="B"><a id="A">Article3</a></li>
<li class="B"><a id="A">Article4</a></li>
</ul>
</li>
<li>About US</li>
</ul>
</div>
<div id="searchbar"><input type="text" name="search" /><button id="button">GO</button></div>
</div>
you need to target ul li ul which you will show and hide ... and #main id can not be duplicate on the same page.. working example as below
#navbar {
background-color: #9C9C9C;
margin: 0px 200px 0px 200px;
height: 30px;
overflow: hidden;
}
#nav {
padding: 0px;
margin: 0px;
font-family: arial;
}
#main {
display: inline;
}
a {
display: block;
text-align: center;
float: left;
width: 100px;
padding: 3px;
line-height: 25px;
text-decoration: none;
color: white;
margin-top: 0px;
}
a:hover {
background-color: #d3d3d3;
color: black;
}
ul li{display: inherit;}
ul li ul {
display: none;
width: auto;
position: absolute;
top: 35px;
background: #ccc;
margin: 0;
padding: 0;
}
ul li ul li{display:block; list-style-type:none}
ul li:hover ul {
display: block;
z-index:1000;
}
#searchbar {
margin: 5px 5px 0px 0px;
float: right;
}
<div id="navbar">
<div>
<ul id="nav">
<li class="nestedchild">More
<ul class="c">
<li class="B"><a id="A">Article1</a></li>
<li class="B"><a id="A">Article2</a></li>
<li class="B"><a id="A">Article3</a></li>
<li class="B"><a id="A">Article4</a></li>
</ul>
</li>
<li id="main">About US</li>
</ul>
</div>
<div id="searchbar"><input type="text" name="search" /><button id="button">GO</button></div>
</div>
Your css should be like that.
.first .link {
color: black;
transform: rotate(-90deg);
width: auto;
border-bottom: 2px solid #FFFFFF;
position: relative;
top: 0vh;
}
.first {
background: green;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.menu {
background-color:red;
}
.bottom-line {
border-bottom:5px solid pink;
}
#navbar{
background-color: #9C9C9C;
margin: 0 auto;
padding: 30px 0;
width: 1200px;
}
#nav{
padding: 0px;
margin: 0px;
font-family: arial;
float: left;
list-style: none;
}
#main{
display: inline;
}
a{
display: block;
text-align: center;
float: left;
width: 100px;
padding: 3px;
line-height: 25px;
text-decoration: none;
color: white;
margin-top: 0px;
}
a:hover{
background-color: #d3d3d3;
color: black;
}
ul li {
float: left;
position: relative;
}
ul li ul {
display: none;
position: absolute;
list-style: none;
top: 32px;
z-index: 5;
background-color: #ddd;
padding-left: 0;
}
ul li:hover ul {
display: block;
}
#searchbar {
margin: 5px 5px 0px 0px;
float: right;
}
and You can also see demo here
My issue is the Html/Css dropdown second level disappears ans I move the cursor, currently works fine on Safari on Iphone but no other browsers I have tried.
Seems to be something to do with the width in the CSS, if I set a fixed px value all seems to fuction but then it does not reize correctly for all screens.
All parameters are % based througout the site and so far that is working fine cross platform.
.third-level-menu {
position: absolute;
top: 0;
width: auto;
list-style: none;
padding: 0;
margin: 0;
display: none;
}
.third-level-menu>li {
height: 30px;
background: #FFF;
}
.third-level-menu>li:hover {
background: #FFF;
}
.second-level-menu {
position: absolute;
top: 30px;
left: 0;
height: auto;
width: auto;
list-style: none;
padding: 0;
margin: 0;
display: none;
z-index: 100;
}
.second-level-menu>li {
position: relative;
height: auto;
background: #FFF;
width: auto;
}
.second-level-menu>li:hover {
background: #FFF;
}
.top-level-menu {
list-style: none;
padding: 0;
margin: 0;
}
.top-level-menu>li {
position: relative;
float: left;
height: auto;
width: auto;
}
.top-level-menu>.style4 {
float: left;
height: auto;
position: relative;
width: auto;
padding-top: 0px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.top-level-menu>li:hover {
background: #FFF;
}
.top-level-menu li:hover>ul {
/* On hover, display the next level's menu */
display: inline;
white-space: nowrap;
}
.top-level-menu a {
font: bold 14px Arial, Helvetica, sans-serif;
color: #093;
text-decoration: none;
padding: 0 0 0 10px;
display: block;
line-height: auto;
}
.top-level-menu a:hover {
color: #3F6;
white-space: nowrap
}
.top-level-menu a {
color: #093;
white-space: nowrap
}
<div id="topmenu">
<ul class="top-level-menu">
<li>Home</li>
<li class="style4">//</li>
<li>Eeeeeeeeee eeeeeeeeeee
<ul class="second-level-menu">
<li>Dddddddd</li>
<li>Dddddddddd</li>
<li>Dddddddddd</li>
</ul>
<li class="style4">//</li>
<li>AAAAAAAAAA
<ul class="second-level-menu">
<li>Two long words</li>
<li>Two very long words</li>
</ul>
<li class="style4">//</li>
<li>Two long words</li>
<li class="style4">//</li>
<li>two words
<ul class="second-level-menu">
<li>single</li>
<li>single</li>
<li class="style4">//</li>
</ul>
<li class="style4">//</li>
<li>Eeeeeee</li>
</ul>
</div>
There is a gap between your main menu and second level menu. Because of that your hover effect is no longer exist. To check try this code
.top-level-menu > li > a { border: 1px solid blue; }
.second-level-menu { border: 1px solid red; }
and to resolve this use
.top-level-menu > li > a { padding:8px 0px; }
Removing top:30px from .second-level-menu will fix the issue.
If you want some gap between the main menu and the second level menu. You can give some padding to the first menu option by adding below-given css -
.second-level-menu > li:first-child {
padding-top: 10px;
}
.third-level-menu {
position: absolute;
top: 0;
width: auto;
list-style: none;
padding: 0;
margin: 0;
display: none;
}
.third-level-menu>li {
height: 30px;
background: #FFF;
}
.third-level-menu>li:hover {
background: #FFF;
}
.second-level-menu {
position: absolute;
left: 0;
height: auto;
width: auto;
list-style: none;
padding: 0;
margin: 0;
display: none;
z-index: 100;
}
.second-level-menu>li {
position: relative;
height: auto;
background: #FFF;
width: auto;
}
.second-level-menu>li:hover {
background: #FFF;
}
.top-level-menu {
list-style: none;
padding: 0;
margin: 0;
}
.top-level-menu>li {
position: relative;
float: left;
height: auto;
width: auto;
}
.top-level-menu>.style4 {
float: left;
height: auto;
position: relative;
width: auto;
padding-top: 0px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.top-level-menu>li:hover {
background: #FFF;
}
.top-level-menu li:hover>ul {
/* On hover, display the next level's menu */
display: inline;
white-space: nowrap;
}
.top-level-menu a {
font: bold 14px Arial, Helvetica, sans-serif;
color: #093;
text-decoration: none;
padding: 0 0 0 10px;
display: block;
line-height: auto;
}
.top-level-menu a:hover {
color: #3F6;
white-space: nowrap
}
.top-level-menu a {
color: #093;
white-space: nowrap
}
<div id="topmenu">
<ul class="top-level-menu">
<li>Home</li>
<li class="style4">//</li>
<li>Eeeeeeeeee eeeeeeeeeee
<ul class="second-level-menu">
<li>Dddddddd</li>
<li>Dddddddddd</li>
<li>Dddddddddd</li>
</ul>
<li class="style4">//</li>
<li>AAAAAAAAAA
<ul class="second-level-menu">
<li>Two long words</li>
<li>Two very long words</li>
</ul>
<li class="style4">//</li>
<li>Two long words</li>
<li class="style4">//</li>
<li>two words
<ul class="second-level-menu">
<li>single</li>
<li>single</li>
<li class="style4">//</li>
</ul>
<li class="style4">//</li>
<li>Eeeeeee</li>
</ul>
</div>
I'm trying to make a drop-down menu appear when mouse-hovered, but for some reason, the menu doesn't appear.
* {
margin: 0;
padding: 0;
}
.header {
position: fixed;
list-style-type: none;
height: 35px;
width: 100%;
overflow: hidden;
background: #333333;
}
.header > li {
display: inline-block;
padding: 8px;
}
.header > li:hover {
background: #000000;
}
.home {
margin-left: 10%;
}
.home a:link {
color: #FFF;
}
.home a:visited {
color: #AAA;
}
.home a:hover {
color: #00F;
}
.home a:active {
color: #F00;
}
.dropdown {
display: block; /* I guess that something is wrong here */
width: auto;
color: #FFF;
}
.dropdown li {
list-style-type: none;
display: block; /* I guess that something is wrong here too */
position: absolute; /* and here */
top: 100%;
color: red;
width: auto;
opacity: 0;
background: yellow;
border: 1px solid black;
transition: opacity 1s;
}
.dropdown:hover,
.dropdown li:hover {
opacity: 1;
}
.main {
margin-top: 20px;
padding-top: 20px;
height: 50px;
display: block;
background: white;
text-align: center;
font-size: 20px;
transition: background 1s;
}
.main:hover {
background: #CCCCCC;
}
<body>
<ul class="header">
<li class="home">⌂ Home
</li>
<li class="dropdown">Dropdown ❱
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</li>
</ul>
<br>
<section>
<div class="main">
Content...
</div>
</section>
</body>
I'm trying to do this using CSS and HTML only.
I've commented beside three lines which I think are causing the problem, but I can't seem to figure it out. What is the issue? How do I fix it?
Firstly, we remove the overflow:hidden from the header which would stop the submenus from showing at all.
Then the parent li should be set to position:relative and the child ul to position:absolute (not the individual li).
Remove the display:none on :hover and there you are.
* {
margin: 0;
padding: 0;
}
.header {
position: fixed;
list-style-type: none;
height: 35px;
width: 100%;
/*overflow: hidden;*/
background: #333333;
}
.header > li {
display: inline-block;
padding: 8px;
}
.header > li:hover {
background: #000000;
}
.home {
margin-left: 10%;
}
.home a:link {
color: #FFF;
}
.home a:visited {
color: #AAA;
}
.home a:hover {
color: #00F;
}
.home a:active {
color: #F00;
}
.dropdown {
color: #FFF;
position: relative;
}
.dropdown ul {
list-style-type: none;
position: absolute;
/* and here */
top: 100%;
left: 0;
color: red;
width: auto;
display: none;
background: yellow;
border: 1px solid black;
}
.dropdown:hover ul {
display: block;
}
.main {
margin-top: 20px;
padding-top: 20px;
height: 50px;
display: block;
background: white;
text-align: center;
font-size: 20px;
transition: background 1s;
}
.main:hover {
background: #CCCCCC;
}
<body>
<ul class="header">
<li class="home">⌂ Home
</li>
<li class="dropdown">Dropdown ❱
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</li>
</ul>
<br>
<section>
<div class="main">
Content...
</div>
</section>
</body>
I have a HTML ul banner that has two li sub-bars that are exposed on hover. However, if you mouse away from it or over another main entry, the hover is lost.
I was wondering if there was some way to easily maintain this hover after a mouse away. It's not something I can toss out so I'm very interested in extending it to support keeping it even after a mouse away for a few seconds, but being able to see new information if hovering over a different li element.
Here is my JSFiddle with an extremely simple demo with my HTML/CSS with the bare minimum to show off the feature: JSFiddle
<body>
<div class="nav-outer-repeat">
<div class="nav">
<div class="table">
<ul class="select">
<li style="color: white;"> <a><b>Hover Test</b></a>
<div class="select_sub">
<ul class="sub">
<li style="color: white;">Test
</li>
<li style="color: white;">Test
</li>
<li style="color: white;">Test
</li>
</ul>
<ul class="sub">
<li style="color: white;">Test
</li>
<li style="color: white;">Test
</li>
<li style="color: white;">Test
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="clear"></div>
<div id="content-outer">
<div id="content"></div>
</div>
#content-outer {
background: url(../../core/images/shared/content_repeat.jpg) repeat-x;
}
#content {
color: #333;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 18px;
margin: 0 auto 0 auto;
max-width: 100%;
min-width: 780px;
padding: 15px 0px 25px 0px;
}
.nav-outer-repeat {
background: url(../../core/images/shared/nav/repeat.jpg) repeat-x;
height: 77px;
}
.nav {
float: left;
font-family: Tahoma;
font-size: 13px;
height: 38px;
position: relative;
width: 1080px;
min-width: 600px;
z-index: 500;
}
.nav-divider {
background: url(../../core/images/shared/nav/divider.jpg) top no-repeat;
float: left;
height: 40px;
width: 15px;
}
.nav .select,
.nav .current {
display: table-cell;
float: left;
list-style: none;
margin: 0 0px 0 0;
padding: 0;
white-space: nowrap;
}
.nav li {
float: left;
height: auto;
margin: 0;
padding: 0;
}
.nav .select a {
color: #fff;
display: block;
float: left;
height: 37px;
line-height: 35px;
padding: 0 0px 0 0px;
text-decoration: none;
white-space: nowrap;
}
.nav .select_sub {
display: none;
margin: 0 0 0 10px;
}
.nav .sub {
display: table;
list-style: none;
padding: 0;
}
.nav .select :hover .select_sub,
.nav .current .show {
background: url(../../core/images/shared/nav/back_0.gif);
height: 75px;
display: block;
left: 0;
padding: 0;
position: absolute;
text-align: left;
top: 37px;
width: 1200px;
z-index: 100;
transition:0s 50s;
}
.nav .select :hover .sub li a,
.nav .current .show .sub li a {
background: transparent;
border: 0;
color: #fff;
font-weight: bold;
font-size: 13px;
display: block;
float: left;
margin: 0;
padding: 0 10px 0 10px;
white-space: nowrap;
}
.clear {
clear: both;
font-size: 0px;
height: 0;
line-height: 0px;
margin: 0px;
padding: 0px;
}
I think I'm most interested in some sort of time delay that it can stay on screen, but all my attempts have failed. I am hoping someone can give me some guidance on solving this with some CSS I may be missing, or perhaps some jQuery?
You can add different transitions on hover and on normal. Make sure you hide your menu with an animatable property! Display won't work and also be careful trying to go from for example, height: 0px; to height: auto;.
Here is one way to do it.
I've forked your fiddle. First I've removed the :hover states and then I added:
.nav .select_sub{
display: block;
}
.nav .select:hover .select_sub,
.nav .select:hover .sub li a{
margin-top: 0%;
transition: all 0.2s;
}
.nav .select .select_sub,
.nav .select .sub li a{
margin-top: -100%;
transition: all 2s 3s;
}
You can see I've hidden your menu with a large top margin. When you hover over .select the margin becomes zero in 0.2s, that should be fast enough for a good user experience.
When you stop hovering the submenu remains for three seconds and then goes back up ten times slower.
Something like this.. but hey I tried.
HTML:
<div class="menu">
<p>Hover</p>
<ul class="menu-content">
<li>
<ul>
<li>Menu 1</li>
<li>Menu 1</li>
<li>Menu 1</li>
<li>Menu 1</li>
</ul>
</li>
<li>
<ul>
<li>Menu 2</li>
<li>Menu 2</li>
<li>Menu 2</li>
<li>Menu 2</li>
</ul>
</li>
</ul>
</div>
CSS:
.menu {
width: 98%;
text-align: center;
padding: 20px 1%;
background-color: #eee;
overflow: hidden;
}
.menu p {
margin: 20px 0;
color: #096847;
font-size: 1.3em;
}
.menu:hover .menu-content {
margin-top: 0;
}
.menu-content {
margin-top: -100%;
overflow: hidden;
transition: all 1s ease-in;
}
.menu-content li {
list-style-type: none;
}
.menu-content > li > ul > li {
width: 25%;
float: left;
padding: 20px 0;
background-color: #2aa87c;
outline: 1px solid #ddd;
cursor: pointer;
color: #fff;
}
RESULT:
EXAMPLE
In pure CSS3 you can use a transition delay: https://developer.mozilla.org/en-US/docs/Web/CSS/transition-delay animating the opacity of the dropdown.
If you can't use CSS3 you have to go with JS (not necessarily jquery)