I am stuck with a drop down menu that example I found at the following url : http://cssdeck.com/labs/another-simple-css3-dropdown-menu
The problem is with the hyper links, I tried to put <li><a href="#">about</></li> within the dropdown but it does not work like the cell over link.
Thanks for the help
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
background: #E3CAA1;
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
<ul><li>Home</li>
<li>About</li>
<li>
Portfolio
<ul>
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
<ul><li>Home</li>
<li>About</li>
<li>Portfolio<ul>
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
try something like this i changed <li>About</li> You forgot to close </a>
EDIT:
add this to your css file. If this is what you mean
a{
text-decoration:none;
color:#fff;
}
Related
May I know how can I make a gap between the drop down title? I tried adding border:1px solid black; but it's ugly. I wish to make it like home | about | portfolio | blog | contact instead of home about portfolio blog contact.
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
background: #E3CAA1;
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
color:#2A0851;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
background: -webkit-linear-gradient(white, grey); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(white, grey); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(white, grey); /* For Firefox 3.6 to 15 */
background: linear-gradient(white, grey); /* Standard syntax (must be last) */
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
<div>
<ul><li>Home</li>
<li>About</li>
<li>
Portfolio
<ul>
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
you can try with this below css where you can add border-left to main <li> and border-bottom to its child's check below updated css it may help you.
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
background: #E3CAA1;
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
color:#2A0851;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
background: -webkit-linear-gradient(white, grey); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(white, grey); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(white, grey); /* For Firefox 3.6 to 15 */
background: linear-gradient(white, grey); /* Standard syntax (must be last) */
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transition: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
div>ul>li{
border-left : 1px solid grey;
}
div>ul>li:first-child {
border-left: none;
}
div ul li ul li{
border-bottom : 1px solid white;
}
<div>
<ul>
<li>Home</li>
<li>About</li>
<li>
Portfolio
<ul>
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
You can use white bottom border and -webkit-transiton: opacity 0.2s; as rightly suggested in comments by freestock.tk
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
background: #E3CAA1;
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
color:#2A0851;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
background: -webkit-linear-gradient(white, grey); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(white, grey); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(white, grey); /* For Firefox 3.6 to 15 */
background: linear-gradient(white, grey); /* Standard syntax (must be last) */
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
.bottom-separator{
border-bottom:solid 1px white;
-webkit-transiton: opacity 0.2s;
}
.title-separator-1{
border-right:solid 1px #555;
}
.title-separator-2{
border-right:solid 1.5px #555;
}
<div>
<ul><li class="title-separator-1">Home</li>
<li class="title-separator-2">About</li>
<li class="title-separator-2">
Portfolio
<ul>
<li class="bottom-separator">Web Design</li>
<li class="bottom-separator">Web Development</li>
<li class="bottom-separator">Illustrations</li>
</ul>
</li>
<li class="title-separator-1">Blog</li>
<li>Contact</li>
</ul>
</div>
If you want some separator, you can place a border to the left or right and eliminate the last/first one respectively using the first-child or last-child pseudo selector.
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
background: #E3CAA1;
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
color: #2A0851;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
background: -webkit-linear-gradient(white, grey);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(white, grey);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(white, grey);
/* For Firefox 3.6 to 15 */
background: linear-gradient(white, grey);
/* Standard syntax (must be last) */
border-left: 1px solid #999;
}
ul li:first-child {
border-left: none;
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover {
background: #666;
}
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
.bottom-separator {
border-bottom: solid 1px white;
-webkit-transiton: opacity 0.2s;
}
<div>
<ul>
<li>Home</li>
<li>About</li>
<li>
Portfolio
<ul>
<li class="bottom-separator">Web Design</li>
<li class="bottom-separator">Web Development</li>
<li class="bottom-separator">Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
add follow css in your style
div > ul > li:nth-child(even){
background: black;
width: 1px;
margin: 0;
padding: 0;
height: 35px;
top: 15px;
z-index: 3;
}
div > ul > li:nth-child(odd) {
margin-left: -5px;
}
Then update your html:
<div>
<ul>
<li>Home</li>
<li></li>
<li>About</li>
<li></li>
<li>Portfolio</li>
<li></li>
<ul>
<li class="bottom-separator">Web Design</li>
<li class="bottom-separator">Web Development</li>
<li class="bottom-separator">Illustrations</li>
</ul>
<li></li>
<li>Blog</li>
<li></li>
<li>Contact</li>
</ul>
</div>
I am trying to create a simple CSS dropdown menu, the function is correct but I am having issues when I place it inside a holding DIV. The menu expands inside the DIV and adds scrolling bars.
I have tried hiding the overflow and positioning the elements but it has no effect:
JSFIDDLE
body
{
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
}
.dropdown
{
text-align: left;
display: inline;
margin: 0;
padding: 0px 4px 0px 0px;
list-style: none;
}
.dropdown li
{
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
/*padding: 15px 20px;*/
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.dropdown li:hover
{
background: #555;
color: #fff;
}
.dropdown li ul
{
padding: 0;
position: absolute;
top: 18px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.dropdown li ul li
{
display: block;
color: #000;
padding-bottom: 5px;
}
.dropdown li ul li:hover
{
background: #666;
}
.dropdown li:hover ul
{
display: block;
opacity: 1;
visibility: visible;
}
<div style="box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08), 1px 1px 4px rgba(255, 255, 255, 0.08) inset;border: 1px solid #DDD; overflow: auto; background-color: #FFF; text-align: center; border-radius: 10px; width:100%; height:50px;">
<ul class="dropdown">
<li>Section1
<ul>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
</ul>
</li>
</ul>
</div>
try like this: JSFIDDLE
.dropdown {
text-align: left;
display: inline-block;
margin: 0;
padding: 0px 4px 0px 0px;
list-style: none;
position:absolute;
top:0;
}
HTML:
<div style="box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08), 1px 1px 4px rgba(255, 255, 255, 0.08) inset;border: 1px solid #DDD;
background-color: #FFF;
text-align: center;
border-radius: 10px;
width:100%;
height:50px; position:relative;">
Add position relative to div and remove overflow property. then add position:absolute to dropdown. Hope this helps !!
Code With Snippet below
body
{
font-family:'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
}
.dropdown
{
text-align: left;
display: inline-block;
margin: 0;
padding: 0px 4px 0px 0px;
list-style: none;
position:absolute;
top:0;
}
.dropdown li
{
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
/*padding: 15px 20px;*/
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.dropdown li:hover
{
background: #555;
color: #fff;
}
.dropdown li ul
{
padding: 0;
position: absolute;
top: 18px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.dropdown li ul li
{
display: block;
color: #000;
padding-bottom: 5px;
}
.dropdown li ul li:hover
{
background: #666;
}
.dropdown li:hover ul
{
display: block;
opacity: 1;
visibility: visible;
}
<div style="box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08), 1px 1px 4px rgba(255, 255, 255, 0.08) inset;border: 1px solid #DDD;background-color: #FFF;text-align: center;border-radius: 10px;width:100%;height:50px; position:relative;">
<ul class="dropdown">
<li>Section1
<ul>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
</ul>
</li>
</ul>
</div>
Give the .dropdown a position absolute; as well.
Fiddle
please try this one:
please Add .dropdown css like this:position absolute;
JSFIDDLE
body
{
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
}
.dropdown
{
position: absolute;
text-align: left;
display: inline;
margin: 0;
padding: 0px 4px 0px 0px;
list-style: none;
}
.dropdown li
{
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
/*padding: 15px 20px;*/
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.dropdown li:hover
{
background: #555;
color: #fff;
}
.dropdown li ul
{
padding: 0;
position: absolute;
top: 18px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.dropdown li ul li
{
display: block;
color: #000;
padding-bottom: 5px;
}
.dropdown li ul li:hover
{
background: #666;
}
.dropdown li:hover ul
{
display: block;
opacity: 1;
visibility: visible;
}
<div style="box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08), 1px 1px 4px rgba(255, 255, 255, 0.08) inset;border: 1px solid #DDD;overflow: auto;background-color: #FFF;text-align: center;border-radius: 10px;width:100%;height:50px;">
<ul class="dropdown">
<li>Section1
<ul>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
</ul>
</li>
</ul>
</div>
I have this navigation, It's working fine. But when I'm apply tags in the li, the text hover, text color effect is just getting messy. I want to apply anchor styling in the css so the text styling remain same after after apply ahrefs.
HTML
<ul class="rexademenu"><li class="rexademenu">Home</li>
<li>About</li>
<li>
Portfolio
<ul class="rexadesubmenu">
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
CSS
.rexademenu {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
.rexademenu li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.rexademenu > li:hover {
background: #555;
color: #fff;
}
.rexadesubmenu {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.rexadesubmenu > li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
.rexadesubmenu > li:hover { background: #666; }
.rexademenu > li:hover .rexadesubmenu {
display: block;
opacity: 1;
visibility: visible;
http://jsfiddle.net/oyp6qkyz/2/
Update your css like this:
Css
.rexademenu li a{
color:#666666;
text-decoration:none;
}
.rexademenu li a:hover, .rexademenu li:hover a{
color:#ffffff;
}
Updated Fiddle
(answer derived from comments)
If you don't want underlining and blue color on the menu, you could add this to the css:
.rexademenu li a, .rexademenu li a:hover {
text-decoration: none;
color: #AAA;
}
.rexademenu li a:hover {
text-decoration: none;
color: white;
}
You override the code in your global css-file with this.
I have this css code for a menu:
/** CUSTOMER MENU **/
#CustomerMenu {
margin-bottom:10px;
}
#CustomerMenu ul {
padding: 0;
margin:0 auto 0 auto;
list-style-type: none;
text-align: center;
display:inline;
}
#CustomerMenu ul li {
display: inline;
}
#CustomerMenu ul li a {
text-decoration: none;
padding: 10px;
color: #FFFFFF;
background-color: #666666;
}
#CustomerMenu ul li a:hover {
color: #fff;
background-color: #f36f25;
}
/** CUSTOMER MENU **/
but its not showing the sub items - fiddle below:
http://jsfiddle.net/dvborqgm/
Here's a quick fix: http://jsfiddle.net/0781wtqu/
Basically, add a class to the submenus ("submenu" in my example) and hide it through a CSS rule, then add another CSS rule to show the hidden class when hovering
#CustomerMenu ul li:hover > ul.submenu {
display: block;
}
You have to use :hover and style for :hover on outer li
The submenu must be having position absolute and li as relative.
Following link provides help to create menu using css
http://www.wikihow.com/Create-a-Dropdown-Menu-in-HTML-and-CSS
Sample menu for your reference
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
background: #E3CAA1;
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
<ul><li>Home</li>
<li>About</li>
<li>
Portfolio
<ul>
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
I'm having trouble creating the third level fligh out for a horizontal css menu. I've tried many different changes to the css to no avail. I have included the menu html and the css. What changes do I need to make to the css to have it work?
When 'ADD SCORES' is hovered over the 2 menus should show to the right
#menu {
background-color: #66A366;
padding: 6px 0 6px 20px;
}
#menu ul li a {
color: #fff;
text-decoration: none;
font-family:"Arial Narrow", "Myriad Pro";
}
#menu li {
color: #fff;
text-decoration: none;
font-family:"Arial Narrow", "Myriad Pro";
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 14px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #66A366;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
z-index:1000;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover {
background: #666;
}
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
ul li ul li:hover li{
display: block;
opacity: 1;
visibility: visible;
}
ul li ul li ul li{
padding: 15px 20px;
font: bold 14px/18px sans-serif;
display: none;
position: relative;
top: -48px;
left: 154px;
width: 120px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
opacity: 0;
z-index:1000;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
<div id="menu">
<ul>
<li>SCORES
<ul>
<li>ADD SCORES
<ul>
<li>Level 3-A-1</li>
<li>Level 3-A-2</li>
</ul>
</li>
<li>EDIT SCORES</li>
</ul>
</li>
<li>PLAYERS
<ul>
<li>ADD PLAYER</li>
<li>EDIT PLAYERS</li>
</ul>
</li>
<li>COURSES
<ul>
<li>ADD COURSE</li>
<li>EDIT COURSES</li>
</ul>
</li>
<li>ADMIN</li>
</ul>
</div>
Demo FIDDLE
I'm not sure how you want your menu to look like, but I noticed that you forgot to wrap the tabs inside a <ul></ul> tag.
If you do that, the menu will look and behave like what most users would expect.
<div id="menu">
<ul> <-- here
<li>SCORES
// some code
<li>ADMIN</li>
</ul> <-- and here
</div>
You can save your time using Swimbi - Swift Menu Builder
- http://f-source.com/swimbi/
have a look at menu demo