css hover drop down parent color - css

Is there a way to keep the a:hover {color:#ffffff } white color also when i'm hovering the sub menu?
http://jsfiddle.net/Lg7q0nen/

Replace this line:
.sf-menu li a:hover { color:#ffffff; }
By this one:
.sf-menu li:hover a { color:#ffffff; }
/*** ESSENTIAL STYLES ***/
.sf-menu, .sf-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu li {
position: relative;
}
.sf-menu ul {
position: absolute;
display: none;
top: 100%;
left: 0;
z-index: 99;
}
.sf-menu > li {
float: left;
}
.sf-menu li:hover > ul,
.sf-menu li.sfHover > ul {
display: block;
}
.sf-menu li { text-transform:uppercase; color:#555a60; }
.sf-menu a {
display: block;
position: relative;
}
.sf-menu ul ul {
top: 0;
left: 100%;
}
.sf-menu i {
position:absolute;
margin:1px 4px;
font-size:18px;
color:#dfd301;
}
.sf-menu i:hover { color:#ffffff; }
/*** DEMO SKIN ***/
.sf-menu {
float: left;
margin-bottom: 1em;
}
.sf-menu ul {
box-shadow: 2px 2px 6px rgba(0,0,0,.2);
min-width: 12em; /* allow long menu items to determine submenu width */
*width: 12em; /* no auto sub width for IE7, see white-space comment below */
}
.sf-menu a {
min-width: 113px;
text-align: center;
padding:20px 16px;
text-decoration: none;
zoom: 1; / IE7 /
}
.sf-menu a {
color: #555a60;
}
.sf-menu li {
/*background: #BDD2FF;*/
white-space: nowrap; /* no need for Supersubs plugin */
*white-space: normal; /* ...unless you support IE7 (let it wrap) */
-webkit-transition: background .2s;
transition: background .2s;
}
.sf-menu li ul li a { padding:10px; text-align:left; color:#ffffff; }
.sf-menu li ul li a:hover { color:#ffffff; }
.sf-menu li ul li { background:#777777; color:#ffffff; }
.sf-menu ul li {
min-width:180px;
text-transform:uppercase; color:#555a60;
}
.sf-menu ul ul li {
background: #9AAEDB;
}
.sf-menu li:hover,
.sf-menu li.sfHover {
background: #b01523;
color:#ffffff;
/* only transition out, not in */
-webkit-transition: none;
transition: none;
}
.sf-menu li:hover a { color:#ffffff; }
/*** arrows (for all except IE7) **/
.sf-arrows .sf-with-ul {
padding-right: 2.5em;
*padding-right: 1em; /* no CSS arrows for IE7 (lack pseudo-elements) */
}
/* styling for both css and generated arrows */
.sf-arrows .sf-with-ul:after {
content: '';
position: absolute;
top: 50%;
right: 1em;
margin-top: -3px;
height: 0;
width: 0;
/* order of following 3 rules important for fallbacks to work */
border: 5px solid transparent;
border-top-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-top-color: rgba(255,255,255,.5);
}
.sf-arrows > li > .sf-with-ul:focus:after,
.sf-arrows > li:hover > .sf-with-ul:after,
.sf-arrows > .sfHover > .sf-with-ul:after {
border-top-color: white; /* IE8 fallback colour */
}
/* styling for right-facing arrows */
.sf-arrows ul .sf-with-ul:after {
margin-top: -5px;
margin-right: -3px;
border-color: transparent;
border-left-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-left-color: rgba(255,255,255,.5);
}
.sf-arrows ul li > .sf-with-ul:focus:after,
.sf-arrows ul li:hover > .sf-with-ul:after,
.sf-arrows ul .sfHover > .sf-with-ul:after {
border-left-color: white;
}
<ul class="sf-menu">
<li>home</li>
<li>
blog
<ul>
<li>Option1</li>
<li>Option2</li>
<li>Option3</li>
</ul>
</li>
<li>page
</li>
<li>contact
</li>
</ul>

On line 95 you can do .sf-menu li:hover a
The key is that you are using the :hover on the li and traverse further after it.

Put the :hover on the whole li.
I added this at the end of your css and it seems to work.
.sf-menu > li:hover > a {
color: white;
}
There's probably a better place to put it, but there was a lot of code there...
http://jsfiddle.net/vvf0shvg/

Related

Navigation Link Hover Border-top have 2 color [duplicate]

This question already has answers here:
How to create multi-color border with CSS?
(3 answers)
Closed 3 years ago.
I'm having problem in my website that I made. When I hover the navigation link I want the border-top have to different color. But when I tried it many times its not working.
result when hovered | expected result
<ul class="h_nav_list">
<li>HOME</li>
<li>PROFILE</li>
<li>ACTIVITY</li>
ul { padding:15px 0; }
ul li { display:inline-block; font-size:16px; padding:10px; }
ul li a { text-decoration:none; color:#222; font-weight:bold; padding-top:50px; }
ul li a.active,
ul li a:hover { color:#014880; border-top:7px solid; width:50%; }
ul li a.list:hover { border-top:7px solid #1880C9; width:50%; }
You have to use after before to achieve this, please check snippet.
ul { padding:15px 0; }
ul li { display:inline-block; font-size:16px; padding:10px;position:relative; }
ul li a { text-decoration:none; color:#222; font-weight:bold; padding-top:50px; }
ul li a.active,
ul li a:hover { color:#014880; border-top:7px solid; width:50%; }
ul li a.list:hover { border-top:7px solid #1880C9; width:50%; }
ul li a:hover:after{position:absolute; width:50%; background:#000; height:5px; content:''; left:0px; top:0px;}
ul li a:hover:before{position:absolute; width:50%; background:#ff0000; height:5px; content:''; right:0px; top:0px;}
<ul class="h_nav_list">
<li>HOME</li>
<li>PROFILE</li>
<li>ACTIVITY</li>
I have created a demo using after and before. Please check this:
ul { padding:15px 0; }
.h_nav_list li {
position: relative;
display: inline-block;
font-size:16px;
padding:20px 10px;
list-style: none;
}
.h_nav_list li a {
color: #000;
text-decoration: none;
}
.h_nav_list li::before,
.h_nav_list li::after {
position: absolute;
top: 0;
left: 0;
width: 50%;
height: 7px;
opacity: 0;
content: '';
transition: .3s all;
}
.h_nav_list li::before {
background-color: #014880;
}
.h_nav_list li::after {
left: 50%;
background-color: #1880C9;
}
.h_nav_list li.active::before,
.h_nav_list li.active::after,
.h_nav_list li:hover::before,
.h_nav_list li:hover::after {
opacity: 1;
}
<ul class="h_nav_list">
<li><a href="index.html class="list active"> HOME </a </li>
<li>PROFILE</li>
<li>ACTIVITY</li>
</ul>
Edit : (See comments below..)
You can add a linear-gradient to your <a> or <li> element with the border-image property.
ul li { display: inline-block; font-size: 20px; list-style: none; border-top: 4px solid darkblue; }
ul li:hover { border-image: linear-gradient(to right, darkblue 50%, aquamarine 0) 4; }
ul li a { text-decoration: none; color: black; }
<ul>
<li>One</li>
<li>Two</li>
<ul>
Your HTML has a bug, the href of HOME wasn't closed with the double quote
The border-top does apply but because of the padding-top: 50px, it wasn't visible. I reduced it to 5px
ul {
padding: 15px 0;
}
ul li {
display: inline-block;
font-size: 16px;
padding: 10px;
}
ul li a {
text-decoration: none;
color: #222;
font-weight: bold;
padding-top: 5px;
position: relative;
}
ul li a::before,
ul li a::after {
content: '';
position: absolute;
top: -5px;
width: 50%;
height: 7px;
display: none;
}
ul li a::before {
background: #014880;
left: 0;
}
ul li a::after {
background: #1880c9;
right: 0;
}
ul li a.active,
ul li a:hover {
color: #014880;
}
ul li a.active::before,
ul li a.active::after,
ul li a:hover::after,
ul li a.list:hover::before,
ul li a.list:hover::after {
display: block
}
<ul class="h_nav_list">
<li>HOME</li>
<li>PROFILE</li>
<li>ACTIVITY</li>
</ul>
Edit: Apologies, misunderstood your question in the first go. Updated the code snippet
try JavaScript for on mouse enter and mouse leave to add style to that element
this code for your html tag :
<li>HOME</li>
make sure to add onload attribute to body tag , to load js function after page loaded like this :
<body onload="myFunction()"></body>
inside myFunction get documents you want to work with like this :
homeLink = document.getElementByID("home");
now you can work with your document element that named homeLink , inside your script.
to add style you want , fisrt create that class or just edit that style attribute like this :
homeEnter() { homeLink.style.border-top = "1px solid black" }
and to make sure style return to default do something like this :
homeLeave() { homeLink.style.border-top = '' }

Responsive CSS issues on my shop

I have some responsive issues on my prestashop site on the top menu block.
Can you please help me solve them?
On media width 500px:
- The height of the categories on the top menu are too high, the "Novedades" item cannot be seen.
On media width 600px:
- The menu subcategories are dropped down automatically by themselves.
On media width 1000px:
- The cloud on "Novedades" item is not set correctly must be a little higher.
Here is the code
/*** ESSENTIAL STYLES ***/
.sf-contener {
clear: both;
}
.sf-right {
margin-right: 14px;
float: right;
width: 7px;
}
.sf-menu, .sf-menu * {
margin: 0;
padding: 0px 0px 0px 0px;
list-style: none;
}
.sf-menu {
margin: 10px 0;
padding:0px 0px 0px 0px;
width:980px;/* 980 */
background: #383838;
/* #media (max-width: 450px) {
.sf-menu {
display: none; } */
}
.sf-menu ul {
position: absolute;
top: -999em;
width: 10em; /* left offset of submenus need to match (see below) */
}
.sf-menu ul li {
width: 100%;
}
.sf-menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.sf-menu li {
float: left;
position: relative;
top: 0;
/*border-right: 1px solid #777;*/
}
.sf-menu a {
display: block;
position: relative;
color:#fff;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
left: 0;
/*padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;*/
top: 35px; /* match top ul list item height */
z-index: 99;
width:auto;
}
ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
left: 200px; /* match ul width */
top: 0;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
left: 200px; /* match ul width */
top: 0;
}
ul.sf-menu li li li:hover ul,
ul.sf-menu li li li.sfHover ul {
left: 200px; /* match ul width */
top: 0;
}
/*** DEMO SKIN ***/
.cat-title {
display: none;
}
.sf-menu {
float: left;
margin-bottom: -2em;
width: 100%;
height: 75px;
background: url('http://www.dulcewashitape.com/themes/dulcewashitape/img/cabecera.png') repeat left center;
}
.sf-menu a {
position: relative;
top: 20px;
display:block;
margin-right:2px;
padding: 0 22px 0 20px;
line-height:35px;
border: 10;
text-decoration:none;
text-transform: uppercase;
font-family:Handlee;
font-size: 18px;
font-weight: bold;
}
.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
color: #916e6e;
white-space:nowrap;
}
.sf-menu li ul {
border:1px solid #f1b6b1; box-shadow:2px 2px 4px rgba(0,0,0,0.25);
width:500px;
padding: 0;
margin: 23px 0px 0px 0px;
top:0;
background: white;
}
.sf-menu li li {
background: white;
position: relative;
top: 0;
height:35px;
line-height:35px;
padding: 0;
margin: 0px 0px 0px 0px;
}
.sf-menu li li a {
font-size: 16px;
text-transform: capitalize;
top:0;
}
.sf-menu li li li {
background: white;
width:140px;
}
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
font-weight: bold;
color: white;
background: url('http://www.dulcewashitape.com/themes/dulcewashitape/img/boton-b.png') no-repeat center 0px;
}
.sf-menu ul li:hover, .sf-menu ul li.sfHover,
.sf-menu ul li a:focus, .sf-menu ul li a:hover, .sf-menu ul li a:active {
background: #eecfd0; //#4e4e4e;
outline: 0;
}
/*** arrows **/
.sf-menu a.sf-with-ul {
padding-right: 2.25em;
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
padding-top: 20px;
margin-top: -20px;
}
.sf-sub-indicator {
position: absolute;
display: block;
right: 10px;
top: 1.05em; /* IE6 only */
width: 10px;
height: 35px;
text-indent: -999em;
overflow: hidden;
background: url('../img/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: 11px;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/* point right for anchors in subs */
.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
/* apply hovers to modern browsers */
.sf-menu ul a:focus > .sf-sub-indicator,
.sf-menu ul a:hover > .sf-sub-indicator,
.sf-menu ul a:active > .sf-sub-indicator,
.sf-menu ul li:hover > a > .sf-sub-indicator,
.sf-menu ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}
/*** shadows for all but IE6 ***/
.sf-shadow ul {
background: url('../img/shadow.png') no-repeat bottom right;
padding: 0 8px 9px 0;
-moz-border-bottom-left-radius: 17px;
-moz-border-top-right-radius: 17px;
-webkit-border-top-right-radius: 17px;
-webkit-border-bottom-left-radius: 17px;
}
.sf-shadow ul.sf-shadow-off {
background: transparent;
}
li.sf-search {
background: inherit;
float: right;
line-height: 25px;
background:transparent;
}
li.sf-search input {
-moz-border-radius: 0 5px 5px 0;
padding: 5px 0;
position: relative;
top: 1px;
padding-left: 30px;
margin: 18px 6px 0 0;
background: #fff url('../../../../img/search-zoom3.png') no-repeat left center;
border:1px solid #777;
}
/* hack IE7 */
.sf-menu a, .sf-menu a:visited {height:34px !IE;}
.sf-menu li li {
width:200px;
background:#726f72 !IE;
}
#block_top_menu .category-thumbnail {
display:none;
clear: both;
width: 100%;
float: none; }
#block_top_menu .category-thumbnail div {
float: left;
width: 33.33333%; }
#block_top_menu .category-thumbnail div img {
max-width: 100%; }
#block_top_menu li.category-thumbnail {
padding-right: 0; }
/* Mobile Item */
.sf-menu-phone-item { display:none; }
#sf-menu-phone-trigger { display:none; position:absolute; top:7px; right:0; background:url('http://www.dulcewashitape.com/themes/dulcewashitape/img/icon-mobile-nav.png') top right no-repeat #29addd; width:50px; height:50px; text-indent:-9999px; border-radius:3px;
-webkit-transition: all 0.5s ease 0s;
-moz-transition: all 0.5s ease 0s;
-o-transition: all 0.5s ease 0s;
transition: all 0.5s ease 0s; }
#sf-menu-phone-trigger:hover { background-color:#333; }
#sf-menu-phone-trigger.active { background-position:bottom right; }
#media only screen and (max-width: 999px) {
.sf-menu a, .sf-menu a:visited {font-size:13px;}
}
/* Tablet Only Queries */
#media only screen and (min-width: 531px) and (max-width: 786px) {
.sf-menu a, .sf-menu a:visited {font-size:12px;}
}
/* Phone Only Queries */
#media only screen and (max-width: 530px) {
#sf-menu-header {height:auto; }
#sf-menu-top-nav {margin-left:-2%; margin-right:-2%;}
/*.sf-menu {display:none; } */
.sf-menu {width:100%; height:auto; margin:10px 0 0 0; position:static !important}
.sf-menu li {width:100%; background:#f4f4f4; border-top:1px solid #fff !important; border-bottom:1px solid #999 !important; -webkit-border-radius:0; border-radius:0; }
.sf-menu li:hover {background:#de8686;}
.sf-menu li ul {width:100%; position:static !important; background:#ccc;}
.sf-menu li li {width:100% !important; background:#ccc; }
/*.sf-menu li li li {display:none !important;}*/
.sf-menu-phone-item { display:block; }
#sf-menu-phone-trigger { display:block; }
.sf-search {padding:10px;}
#searchbox {margin-left:15px;}
#searchbox input[type="text"] {width:80%;}
#searchbox input[type="text"]:focus, #searchbox input[type="text"]:hover {width:80%;}
#searchbox .button {width:10%;}
#header_logo { padding-right:50px; text-align:left !important;}
}
And the site is : [www.dulcewashitape.com][1]
Thank you very much I really appreciate your help
On media width 1000px: The "Washi Tape" text is reading the CSS for the a.sf-with-ul class whereas the "Novedades" is executing the CSS for a, and they have differing CSS values.
Take the CSS in a.sf-with-ul and apply it to the a to align your clouds:
ul.sf-menu li a {
padding-right: 2.25em;
min-width: 1px;
padding-top: 20px;
margin-top: -20px;
}
On media width 500px: You have a top:20px; that pushes your text down assigned inside .sf-menu a. Removing it is not an option since it causes misalignment at higher screen widths to your menu. Given this constraint, you can create a special rule using the following to only apply your desired top:5px; if the screen width is less than or equal to 500px
#media screen (max-width: 500px) {
.sf-menu a{
top:5px;
}
}
Unfortunately I do now know how to fix the automatically dropping down menu, goodluck!

How to stick a background behind the navbar?

I have a problem here.
I'm using wordpress and I was confused.
How to stick background behind the nav bar?.
I activated LowerMedia Sticky.js menu's plugin, then I want to change my navbar background color. I try to add a background: #000; in #navigation. It's look okay, but when I scroll down, the navigation background is not move. There's only the navigation text that moved. I try to move background: #000; to #navigation .sf-menu a but the background is only appear around the text, even it move with the text when I scroll down. I don't know what to do now. Please help me. Thanks before.
This is my site : vitraprawira.net
This is my final navbar css code:
/* Main Navigation
================================================== */
/*hide responsive nav*/
#top-bar .selector, #navigation .selector { display: none; }
/*core*/
.sf-menu, .sf-menu * { margin: 0; padding: 0; list-style: none; }
.sf-menu { line-height: 1.0 }
.sf-menu ul { position: absolute; top: -999em; width: 180px; }
.sf-menu ul li { width: 100% }
.sf-menu li:hover { visibility: inherit }
.sf-menu li { float: left; position: relative; }
.sf-menu a { display: block; position: relative; }
.sf-menu li:hover ul, .sf-menu li.sfHover ul { left: 0px; top: 30px; z-index: 99; }
ul.sf-menu li:hover li ul, ul.sf-menu li.sfHover li ul { top: -999em }
ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { left: 180px; top: 1px; }
/*styling*/
#navigation-wrap { position: relative; display: block; }
#navigation { margin-left: 170px; margin-right: auto; position: relative; height: 55px; transparent: none; }
#navigation .sf-menu > li:hover > ul, .sf-menu li.sfHover > ul { top: 50px }
#navigation ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul, ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { left: 200px; top: 0; }
#navigation .sf-menu a { font-size: 1.000em; height: 55px; line-height: 55px; color: #fff; background: #000 url("images/vintage.png"); }
#navigation .sf-menu > li > a { border-radius: 2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; }
#navigation .sf-menu li { float: left; position: relative; }
#navigation .sf-menu > li { background: url("images/dash.png") right center no-repeat; margin-right: 20px; padding-right: 20px; }
#navigation .sf-menu > li:last-child { margin: 0; padding: 0; }
#navigation .sf-menu > li > a:hover { color: #fff }
#navigation .sf-menu > .current-menu-item > a { color: #7094DB }
#navigation .sf-menu > li.sfHover > a { color: #fff }
/*drop-down styles*/
#navigation .sf-menu ul { position: absolute; nowhitespace: afterproperty; top: -999em; width: 200px; z-index: 9999; left: 0; border: 1px solid #ddd; box-shadow: 0 0 8px rgba(0,0,0,0.08); }
#navigation .sf-menu ul > li:last-child { -webkit-border-bottom-right-radius: 2px; -webkit-border-bottom-left-radius: 2px; -moz-border-radius-bottomright: 2px; -moz-border-radius-bottomleft: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; }
#navigation .sf-menu ul li { background: #000; border-bottom: 1px solid rgba(0,0,0,0.05); }
#navigation .sf-menu ul li:first-child { border-top: 0 }
#navigation .sf-menu ul li:last-child { border-bottom: 0 }
#navigation .sf-menu ul a { display: block; padding: 10px; color: #fff; height: auto; margin: 0px; border: 0px; line-height: 1.8em; font-size: 0.923em; text-shadow: none; }
#navigation .sf-menu ul li > a:hover { color: #7094DB; background: #2D3B58; }
If you're wanting the color/image to appear behind the entire menu block, then you're localizing the background too close to the anchor element.
Just do this: #navigation {background: #ccc;} or whatever color you want.

css drop down menu not working on hover

I have a simple menu that when hover it will have a drop down menu. The code is working when testing in Fiddle but not working on IE when run the whole page locally. Can anybody help
(here's my code at fiddle)[http://jsfiddle.net/bACbW]
<DIV align="left" id="floating-menu"><FONT class="subheading">
<ul class="dropmenu">
<li>MAIN MENU
<ul class="dropmenu">
<li>WELCOME</li>
<li>PERSONAL INFORMATION</li>
</ul>
</li>
</ul>
</FONT></DIV>
general.css
/* All UL */
#floating-menu ul {
list-style-type: none;
width: auto;
height: 30px;
background: #FF0040;
}
/* All LI */
#floating-menu ul li {
padding: 5px 10px;
height: 30px;
position: relative;
}
/* First Level LI */
#floating-menu>ul>li {
float: left;
height: 30px;
line-height: 27px;
text-aligh: center;
color: #9c9c9c;
}
#floating-menu li ul {
display: none;
position: absolute;
left: 0;
width: 200px;
}
#floating-menu li:hover ul {
display: block;
}
#floating-menu li li {
border-bottom: 1px solid #ffffff;
}
#floating-menu li li:hover {
background: #5e8ce9;
}
.dropmenu {
_zoom:1;
}
.dropmenu:after {
content: "";
clear: both;
display: block;
}
Check the jsFiddle link here and below corrected CSS. Also tested in Firefox, chrome, and ie 7, 8 and 9. It working properly.
#floating-menu {
width:940px;
padding:10px;
*padding:5px 10px;
margin:0 auto;
border:1px solid green;
background-color:#3D3A40;
border:8px solid #fff;
}
#floating-menu ul {
list-style-type: none;
line-height:30px;
background: #FF0040;
}
#floating-menu ul li {
position:relative;
display:inline-block;
*float:left;
}
#floating-menu ul li a {
color:#fff;
text-decoration:none;
display:block;
padding:0 20px;
cursor:pointer;
}
#floating-menu ul li:hover a {
color:#fff;
background-color:#5e8ce9;
cursor:pointer;
}
#floating-menu ul li ul {
display:none;
position:absolute;
left:0;
top:30px;
background-color:#5e8ce9;
width:200px;
line-height:18px;
}
#floating-menu ul li ul li {
border-bottom:1px solid #91b3f7;
display:block;
*float:none;
}
#floating-menu ul li ul li a {
color:#fff;
background-color:#0066FF;
cursor:pointer;
padding:5px 10px;
}
#floating-menu ul li ul li a:hover,
#floating-menu ul li ul li a.active {
color:#fff;
background-color:#0000FF;
}
#floating-menu ul li:hover ul {
display:block !important;
}
.dropmenu {
_zoom:1;
}
As I said in comments, your code works fine in IE9.
The reason, press F12 to get developer tools and change the document type.
As you said it is in Quirks mode
!-- Force IE to use the latest version of its rendering engine -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
By telling IE to use the latest version of its rendering engine in your page.
Incase if your user has only IE8 browser? This will certainly fails.
You can check this in MSDN Library.
Hope you understand.

superfish menu styling issue

Im trying to style my superfish menu in my Wordpress theme. Im trying to elimate the gap between the dropdown when on hover.
As you can see from the picture there is a small gap.
I have tried to edit the below code which i believe is applicable to the section in question. However when applying a negative margin its making the options overlap as shown.
Im currently editting the below code:-
.sf-menu li li {
background: #193030;
}
however placing a margin-top: -10px; produces this:-
Your help and advice is appreciated.
thanks
EDIT
Please see full CSS of superfish :)
/*** ESSENTIAL STYLES ***/
.sf-menu, .sf-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu {
line-height: 1.0;
}
.sf-menu ul {
position: absolute;
top: -999em;
width: 10em; /* left offset of submenus need to match (see below) */
}
.sf-menu ul li {
width: 100%;
}
.sf-menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.sf-menu li {
float: left;
position: relative;
}
.sf-menu a {
display: block;
position: relative;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
left: 0;
top: 2.5em; /* match top ul list item height */
z-index: 99;
}
ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
left: 10em; /* match ul width */
top: -10;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li li:hover ul,
ul.sf-menu li li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
/*** DEMO SKIN ***/
.sf-menu {
float: left;
margin-bottom: 1em;
}
.sf-menu a {
border-right: 1px solid #193030;
padding: .75em 1em;
text-decoration:none;
font: 11.5px Open Sans;
text-transform: uppercase;
color: #fff;
}
.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
color: #fff;
}
.sf-menu li {
background: transparent;
}
.sf-menu li a {color: #fff;}
.sf-menu li li {
background: #193030;
margin-top: -0px;
}
.sf-menu li li a:hover {background-color: #0a1c1c;}
.sf-menu li li li {
background: #9AAEDB;
}
.sf-menu li:hover, .sf-menu li.sfHover,
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
background: #193030;
outline: 0;
}
/*** arrows **/
.sf-menu a.sf-with-ul {
padding-right: 2.25em;
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
}
.sf-sub-indicator {
position: absolute;
display: block;
right: .75em;
top: 1.5em; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -999em;
overflow: hidden;
background: url('images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: 1.0em;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/* point right for anchors in subs */
.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
/* apply hovers to modern browsers */
.sf-menu ul a:focus > .sf-sub-indicator,
.sf-menu ul a:hover > .sf-sub-indicator,
.sf-menu ul a:active > .sf-sub-indicator,
.sf-menu ul li:hover > a > .sf-sub-indicator,
.sf-menu ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}
/*** shadows for all but IE6 ***/
.sf-shadow ul {
background: url('../images/shadow.png') no-repeat bottom right;
padding: 0 8px 9px 0;
-moz-border-radius-bottomleft: 17px;
-moz-border-radius-topright: 17px;
-webkit-border-top-right-radius: 17px;
-webkit-border-bottom-left-radius: 17px;
}
.sf-shadow ul.sf-shadow-off {
background: transparent;
}
this has now been fixed thanks to the lovely Florian..
I needed to amend
.sf-menu li.sfHover ul {
left: 0;
top: 2.1em; /* match top ul list item height */
z-index: 99;
}
This stated how far the UL was from the top.
I hope this knowledge helps others too.

Resources