I am relatively new to CSS and tried to create a CSS DropDown menu.
After many hours of css reading I have created one, but the last child on the parent UL bleeds over when on hover.
Here is JSFiddle link: JSFiddle Code
<mini-nav>
<ul>
<li>Services
<ul>
<li>Service 1</li>
<li>Service 2</li>
<li>Service 3</li>
<li>Service 4</li>
</ul>
</li>
<li>Security
<ul>
<li>Security 1</li>
<li>Security 2</li>
<li>Security 3</li>
</ul>
</li>
<li>Centres
<ul>
<li>Centres 1</li>
<li>Centres 2</li>
<li>Centres 3</li>
</ul>
</li>
</ul>
mini-nav ul
{
width: 237px;
text-align: center;
display: inline;
margin: 0;
padding: 5px 0 5px 0px;
list-style-type: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #58585A;
box-shadow: 3px 3px 5px #828282;
}
mini-nav ul li
{
font-size: 13px;
display: inline-block;
margin-right: -4px;
position: relative;
width: 78px;
padding: 5px 0 5px 0px;
border-right: 1px solid white;
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;
}
mini-nav ul > li:last-child
{
border-right: none;
}
mini-nav ul li:hover
{
background: #E8E8E8;
color: black;
background-image: url(../mes-images/menu-topper.png);
background-position: top left;
background-repeat: repeat-x;
display: inline-block;
}
mini-nav ul li:hover:first-child
{
-moz-border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
border-radius: 5px 0 0 0;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
mini-nav ul li:hover:last-child
{
-moz-border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0;
border-radius: 0 5px 0 0;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
mini-nav ul li:hover a
{
color: black;
}
mini-nav ul li:hover ul
{
display: block;
opacity: 0.8;
visibility: visible;
}
mini-nav ul li a
{
color: White; text-decoration: none;
}
mini-nav ul li ul
{
text-align: left;
padding:0;
position: absolute;
top: 27px;
left: 0;
width: auto;
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;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
mini-nav ul ul > li:last-child
{
border-bottom: none;
}
mini-nav ul li ul li:hover
{
background: #E8E8E8;
color: black;
width: 110px;
}
mini-nav ul li ul li
{
display: block;
color: #fff;
width: 110px;
border-bottom: solid 1px silver;
padding-left: 12px;
border-right: none;
margin-right: 0;
}
mini-nav ul li ul li:hover:last-child
{
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
I apologize for my bastardized css!!!
On your Css, find this code
mini-nav ul > li:last-child { border-right: none; }
and add "margin:0" into it so it like this :
mini-nav ul > li:last-child { border-right: none; margin:0; }
Finally, this is what you want ?
DEMO
Working code if link was broken :
/* Parent CSS */
mini-nav ul {
width: 237px;
text-align: center;
display: inline;
margin: 0;
padding: 5px 0 5px 0px;
list-style-type: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #58585A;
box-shadow: 3px 3px 5px #828282;
}
mini-nav ul li {
font-size: 13px;
display: inline-block;
margin-right:-4px;
position: relative;
width: 78px;
padding: 5px 0 5px 0px;
border-right: 1px solid white;
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;
}
mini-nav ul > li:last-child { border-right: none; margin:0; }
mini-nav ul li:hover
{
background: #E8E8E8;
color: black;
background-image: url(../mes-images/menu-topper.png);
background-position: top left;
background-repeat: repeat-x;
display: inline-block;
}
mini-nav ul li:hover:first-child {
-moz-border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
border-radius: 5px 0 0 0;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
mini-nav ul li:hover:last-child {
-moz-border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0;
border-radius: 0 5px 0 0;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
mini-nav ul li:hover a { color: black; }
mini-nav ul li:hover ul {
display: block;
opacity: 0.8;
visibility: visible;
}
mini-nav ul li a { color: White; text-decoration: none; }
/* Child CSS */
mini-nav ul li ul {
text-align: left;
padding:0;
position: absolute;
top: 27px;
left: 0;
width: auto;
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;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
mini-nav ul ul > li:last-child { border-bottom: none; }
mini-nav ul li ul li:hover {
background: #E8E8E8;
color: black;
width: 110px;
}
mini-nav ul li ul li {
display: block;
color: #fff;
width: 110px;
border-bottom: solid 1px silver;
padding-left: 12px;
border-right: none;
margin-right: 0;
}
mini-nav ul li ul li:hover:last-child {
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
It's because .mini-nav ul li is
position:relative;
margin-right:-4px;
You've made it go right 4 pixels and that's throwing it out.
Related
This is the actual output
How to remove the highlighted section in red, in the actual output?
This is my expected output
JSFiddle Demo link
Example,
.wizard ul
{
list-style: none outside none;
padding: 0;
margin: 0;
width: 4000px;
}
.wizard ul li
{
float: left;
margin: 0;
padding: 0 20px 0 30px;
line-height: 35px;
position: relative;
background: #f5f5f5;
color: #d0d0d0;
font-size: 12px;
cursor: default;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li .chevron
{
border: 24px solid transparent;
border-left: 14px solid #d4d4d4;
border-right: 0;
border-width: 18px 0 17px 14px;
display: block;
position: absolute;
right: -14px;
top: 0;
z-index: 1;
}
.wizard ul li .chevron:before
{
border: 24px solid transparent;
border-left: 14px solid #f5f5f5;
border-right: 0;
content: "";
display: block;
position: absolute;
right: 1px;
top: -24px;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li.complete
{
background: #f5f5f5;
color: #444;
}
.wizard ul li.complete:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.complete:hover
{
background: #eee;
cursor: pointer;
}
.wizard ul li.complete:hover .chevron:before
{
border-left: 20px solid #eee;
}
.wizard ul li.complete .chevron:before
{
border-left: 20px solid #f5f5f5;
}
.wizard ul li.active
{
background: #428bca;
color: #262626;
}
.wizard ul li.active:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.active .chevron:before
{
border-left: 14px solid #428bca;
}
.wizard ul li .badge
{
margin-right: 8px;
}
.wizard ul li:first-child
{
-webkit-border-radius: 2px 0 0 0;
-webkit-background-clip: padding-box;
-moz-border-radius: 2px 0 0 0;
-moz-background-clip: padding;
border-radius: 2px 0 0 0;
background-clip: padding-box;
padding-left: 20px;
}
/**/
</style>
<div data-target="#simplewizardinwidget-steps" class="wizard" id="simplewizardinwidget">
<ul class="steps">
<li class="complete" data-target="#simplewizardinwidgetstep1">Personal Information<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep3" class="active">Profile<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification1<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification2<span class="chevron"></span></li>
</ul>
</div>
kindly assist me to achieve this..
Html Part
add overflow: hidden; to .wizard ul
.wizard ul
{ overflow: hidden;
list-style: none outside none;
padding: 0;
margin: 0;
width: 4000px;
}
.wizard ul li
{
float: left;
margin: 0;
padding: 0 20px 0 30px;
line-height: 35px;
position: relative;
background: #f5f5f5;
color: #d0d0d0;
font-size: 12px;
cursor: default;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li .chevron
{
border: 24px solid transparent;
border-left: 14px solid #d4d4d4;
border-right: 0;
border-width: 18px 0 17px 14px;
display: block;
position: absolute;
right: -14px;
top: 0;
z-index: 1;
}
.wizard ul li .chevron:before
{
border: 24px solid transparent;
border-left: 14px solid #f5f5f5;
border-right: 0;
content: "";
display: block;
position: absolute;
right: 1px;
top: -24px;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li.complete
{
background: #f5f5f5;
color: #444;
}
.wizard ul li.complete:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.complete:hover
{
background: #eee;
cursor: pointer;
}
.wizard ul li.complete:hover .chevron:before
{
border-left: 20px solid #eee;
}
.wizard ul li.complete .chevron:before
{
border-left: 20px solid #f5f5f5;
}
.wizard ul li.active
{
background: #428bca;
color: #262626;
}
.wizard ul li.active:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.active .chevron:before
{
border-left: 14px solid #428bca;
}
.wizard ul li .badge
{
margin-right: 8px;
}
.wizard ul li:first-child
{
-webkit-border-radius: 2px 0 0 0;
-webkit-background-clip: padding-box;
-moz-border-radius: 2px 0 0 0;
-moz-background-clip: padding;
border-radius: 2px 0 0 0;
background-clip: padding-box;
padding-left: 20px;
}
<br/>
<br/>
<div data-target="#simplewizardinwidget-steps" class="wizard" id="simplewizardinwidget">
<ul class="steps">
<li class="complete" data-target="#simplewizardinwidgetstep1">Personal Information<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep3" class="active">Profile<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification1<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification2<span class="chevron"></span></li>
</ul>
</div>
I've been trying for a while now to center everything that's in my Navigation Bar. Here's my CSS and HTML code I would appreciate it if anyone could give me a hint on what to do.
#cssmenu ul {
margin: 0;
padding: 0;
}
#cssmenu li {
margin: 0;
padding: 0;
}
#cssmenu a {
margin: 0;
padding: 0;
}
#cssmenu ul {
list-style: none;
}
#cssmenu a {
text-decoration: none;
}
#cssmenu {
height: 70px;
background-color: #232323;
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.4);
width: auto;
text-align: center;
}
#cssmenu > ul > li {
float: left;
margin-left: 15px;
position: relative;
}
#cssmenu > ul > li > a {
color: #a0a0a0;
font-family: Verdana, 'Lucida Grande';
font-size: 15px;
line-height: 70px;
padding: 15px 20px;
-webkit-transition: color .15s;
-moz-transition: color .15s;
-o-transition: color .15s;
transition: color .15s;
}
#cssmenu > ul > li > a:hover {
color: #ffffff;
}
#cssmenu > ul > li > ul {
opacity: 0;
visibility: hidden;
padding: 16px 0 20px 0;
background-color: #fafafa;
text-align: left;
position: absolute;
top: 55px;
left: 50%;
margin-left: -90px;
width: 180px;
-webkit-transition: all .3s .1s;
-moz-transition: all .3s .1s;
-o-transition: all .3s .1s;
transition: all .3s .1s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
}
#cssmenu > ul > li:hover > ul {
opacity: 1;
top: 65px;
visibility: visible;
}
#cssmenu > ul > li > ul:before {
content: '';
display: block;
border-color: transparent transparent #fafafa transparent;
border-style: solid;
border-width: 10px;
position: absolute;
top: -20px;
left: 50%;
margin-left: -10px;
}
#cssmenu > ul ul > li {
position: relative;
}
#cssmenu ul ul a {
color: #323232;
font-family: Verdana, 'Lucida Grande';
font-size: 13px;
background-color: #fafafa;
padding: 5px 8px 7px 16px;
display: block;
-webkit-transition: background-color 0.1s;
-moz-transition: background-color 0.1s;
-o-transition: background-color 0.1s;
transition: background-color 0.1s;
}
#cssmenu ul ul a:hover {
background-color: #f0f0f0;
}
#cssmenu ul ul ul {
visibility: hidden;
opacity: 0;
position: absolute;
top: -16px;
left: 206px;
padding: 16px 0 20px 0;
background-color: #fafafa;
text-align: left;
width: 180px;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
}
#cssmenu ul ul > li:hover > ul {
opacity: 1;
left: 190px;
visibility: visible;
}
#cssmenu ul ul a:hover {
background-color: #cc2c24;
color: #f0f0f0;
}
And finally my HTML.
<div id='cssmenu'>
<ul>
<li class='active'><a href='index.html'><span>Home</span></a></li>
<li><a href='#'><span>Forums</span></a></li>
<li><a href='#'><span>Title1</span></a></li>
<li><a href='#'><span>Title2</span></a></li>
<li><a href='#'><span>Title3</span></a></li>
<li class='last'><a href='#'><span>Title4</span></a></li>
</ul>
</div>
Currently all that happens is my navigation bar is 100% width which is what I want but, the buttons are still aligned to the left and I want them to be in the center. I've tried numerous things and can't seem to make it work. Any help is greatly appreciated.
You only need this :
#cssmenu > ul {
display:table;
margin:0 auto;
}
View the demo http://jsfiddle.net/sn3Hn/2/
Use same structure, but you need change your css:
#cssmenu ul
{
text-align: center;
}
#cssmenu li
{
display: inline-block; < Secret;
margin: 0;
padding: 0;
}
Codepen > http://cdpn.io/usChr
Resolve?
Good lucky
I've had success using the css table method.
#cssmenu ul {
display: table;
width: 100%;
}
#cssmenu ul li {
display: table-cell;
}
My site has one drop down menu which does not work in iOS or on android. I know the problem is due to the lack of cursor on these devices, so I'm looking to switch the menu from a hover action to a clickable one. I lack the proper terms to speak intelligently on this subject so hopefully what I'm asking makes sense. www.salvageinteriors.com
Here's my code:
CSS:
#cssmenu ul {
margin: 0;
padding: 0;
}
#cssmenu li {
margin: 0;
padding: 0;
z-index: 29;
}
#cssmenu a {
margin: 0;
padding: 0;
}
#cssmenu ul {
list-style: none;
}
#cssmenu a {
text-decoration: none;
}
#cssmenu {
height: 31px;
background-color: #ffffff;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4);
width: 940px;
}
#cssmenu > ul > li {
float: left;
margin-left: 45px;
margin-top: -20px;
position: relative;
}
#cssmenu > ul > li > a {
color: #000000;
font-family: calibri;
font-size: 18px;
line-height: 70px;
padding: 15px 20px;
-webkit-transition: color .15s;
-moz-transition: color .15s;
-o-transition: color .15s;
transition: color .15s;
}
#cssmenu > ul > li > a:hover {
color: #000000;
}
#cssmenu > ul > li > ul {
opacity: 0;
visibility: hidden;
padding: 16px 0 20px 0;
background-color: #000000;
text-align: left;
position: absolute;
top: 55px;
left: 50%;
margin-left: -90px;
width: 180px;
-webkit-transition: all .3s .1s;
-moz-transition: all .3s .1s;
-o-transition: all .3s .1s;
transition: all .3s .1s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4);
}
#cssmenu > ul > li:hover > ul {
opacity: 1;
top: 65px;
visibility: visible;
}
#cssmenu > ul > li > ul:before {
content: '';
display: block;
border-color: transparent transparent #000000 transparent;
border-style: solid;
border-width: 10px;
position: absolute;
top: -20px;
left: 50%;
margin-left: -10px;
}
#cssmenu > ul ul > li {
position: relative;
}
#cssmenu ul ul a {
color: #ffffff;
font-family: Verdana, 'Lucida Grande';
font-size: 13px;
background-color: #000000;
padding: 5px 8px 7px 16px;
display: block;
-webkit-transition: background-color 0.1s;
-moz-transition: background-color 0.1s;
-o-transition: background-color 0.1s;
transition: background-color 0.1s;
}
#cssmenu ul ul a:hover {
background-color: #000000;
}
#cssmenu ul ul ul {
visibility: hidden;
opacity: 0;
position: absolute;
top: -16px;
left: 206px;
padding: 16px 0 20px 0;
background-color: #ffffff;
text-align: left;
width: 180px;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
}
#cssmenu ul ul > li:hover > ul {
opacity: 1;
left: 190px;
visibility: visible;
}
#cssmenu ul ul a:hover {
background-color: #ffffff;
color: #000000;
}
HTML:
<div id='cssmenu'>
<ul>
<li class='has-sub'><a href='http://www.salvageinteriors.com/p/work.html'> <span>Work</span></a>
<ul>
<li><a href='http://www.salvageinteriors.com/p/commercial.html'><span>Commercial Fixtures</span></a></li>
<li><a href='http://www.salvageinteriors.com/p/furniture_13.html'><span>Furniture</span></a></li>
<li class='last'><a href='http://www.salvageinteriors.com/p/accoutrements.html'><span>Accoutrements</span></a></li>
</ul>
</li>
<li><a href='http://www.salvageinteriors.com/p/about.html'><span>About</span></a></li>
<li><a href='http://www.salvageinteriors.com/p/clients.html'><span>Clients</span></a></li>
<li><a href='http://www.salvageinteriors.com/p/press.html'><span>Press</span></a></li>
<li><a href='http://salvageinteriors.bigcartel.com/' target='_blank'><span>Shop</span></a></li>
<li><a href='http://salvageinteriorsblog.com/' target='_blank'><span>Blog</span></a></li>
<li class='last'><a href='http://www.salvageinteriors.com/p/contact.html'> <span>Contact</span></a></li>
</ul>
</div>
honestly, at least until everyone can figure out hovers for touch devices, we're kind of screwed when it comes to this stuff. There are two ways to work around this:
1) put all of your hover declarations behind a touch class and use Modernizr to add a touch class to your body element whenever the device is detected to be touch enabled.
2)Or you can just put your hover declarations inside of a media query that targets anything over 1024px.
Neither of these are very good solutions, but I will be the first to admit that I have used them before. I would probably use Modernizr if possible.
Down below the picture is my code for my css menu where it says
Sub Item i want that area to popup on the left of where it says Product1
thank you soo much in advance.. i used CSS menu makers to make this but they dont have an option to chose where it floats
im posting my code below the image
/** Body Of Website */
body{
background-image:url('/images/background.png');
background-color:#0a1857;
}
/** Advanced css menu */
#cssmenu ul { margin: 0; padding: 0;}
#cssmenu li { margin: 0; padding: 0;}
#cssmenu a { margin: 0; padding: 0;}
#cssmenu ul {list-style: none;}
#cssmenu a {text-decoration: none;}
#cssmenu {height: 70px; background-color: rgb(35,35,35); box-shadow: 0px 2px 3px rgba(0,0,0,.4);}
#cssmenu > ul > li {
float: left;
margin-left: 35px;
position: relative;
}
#cssmenu > ul > li > a {
color: rgb(160,160,160);
font-family: Verdana, 'Lucida Grande';
font-size: 15px;
line-height: 70px;
padding: 15px 20px;
-webkit-transition: color .15s;
-moz-transition: color .15s;
-o-transition: color .15s;
transition: color .15s;
}
#cssmenu > ul > li > a:hover {color: rgb(250,250,250); }
#cssmenu > ul > li > ul {
opacity: 0;
visibility: hidden;
padding: 16px 0 20px 0;
background-color: rgb(250,250,250);
text-align: left;
position: absolute;
top: 55px;
left: 50%;
margin-left: -90px;
width: 180px;
-webkit-transition: all .3s .1s;
-moz-transition: all .3s .1s;
-o-transition: all .3s .1s;
transition: all .3s .1s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
-moz-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
box-shadow: 0px 1px 3px rgba(0,0,0,.4);
}
#cssmenu > ul > li:hover > ul {
opacity: 1;
top: 65px;
visibility: visible;
}
#cssmenu > ul > li > ul:before{
content: '';
display: block;
border-color: transparent transparent rgb(250,250,250) transparent;
border-style: solid;
border-width: 10px;
position: absolute;
top: -20px;
left: 50%;
margin-left: -10px;
}
#cssmenu > ul ul > li { position: relative;}
#cssmenu ul ul a{
color: rgb(50,50,50);
font-family: Verdana, 'Lucida Grande';
font-size: 13px;
background-color: rgb(250,250,250);
padding: 5px 8px 7px 16px;
display: block;
-webkit-transition: background-color .1s;
-moz-transition: background-color .1s;
-o-transition: background-color .1s;
transition: background-color .1s;
}
#cssmenu ul ul a:hover {background-color: rgb(240,240,240);}
#cssmenu ul ul ul {
visibility: hidden;
opacity: 0;
position: absolute;
top: -16px;
left: 206px;
padding: 16px 0 20px 0;
background-color: rgb(250,250,250);
text-align: left;
width: 160px;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
-moz-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
box-shadow: 0px 1px 3px rgba(0,0,0,.4);
}
#cssmenu ul ul > li:hover > ul { opacity: 1; left: 196px; visibility: visible;}
#cssmenu ul ul a:hover{
background-color: rgb(205,44,36);
color: rgb(240,240,240);
}
Have a look at this apply the following style or change the value for "left" if you want
#cssmenu ul ul > li:hover > ul {
left: -50px; **Change this to whatever you want to**
opacity: 1;
visibility: visible;
}
^ this is on line number 105 of your CSS stylesheet.
Hope this helps! Let me know how it goes :)
UPDATE:-
Change this as well
#cssmenu ul ul ul {
left: -50px; /* Change this to whatever value you used for the above "left" attribute */
This should fix the strange transition issue.
Cant you manually position the sub menu?
Just add a class to the sub menu, and
subnav { position: absolute; top:10;left:10; }?
I have a dropdown menu made fully in CSS (no JS). I'd like the top level menu item to stay highlighted when I hover on its dropdown menus but I can't figure out how.
Here is an example of what I'm talking about: when you place your cursor on the dropdown, the top level item goes back to default color...
Could anyone help with that? Is there a rule in CSS that would fix that?
Here is the CSS:
nav {
z-index: 10001;
position: relative;
display: block;
width: 100%;
height: 45px;
text-transform: uppercase;
border-bottom: 1px solid white;
color: white;
text-shadow: none;
text-align: center
}
nav a {
text-decoration: none
}
#topmenu {
position: relative;
text-align: left;
left: 2%
}
nav ul {
white-space: nowrap;
list-style: none;
position: relative;
display: inline-block
}
nav ul ul {
visibility: hidden;
opacity: 0;
-webkit-opacity: 0;
-moz-opacity: 0;
transition: opacity .3s linear,visibility .3s linear;
-webkit-transition: opacity .3s linear,visibility .3s linear;
-moz-transition: opacity .3s linear,visibility .3s linear;
-o-transition: opacity .3s linear,visibility .3s linear
}
nav ul ul li: last-child {
-webkit-border-bottom-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-moz-border-radius-bottomright: 6px;
-moz-border-radius-bottomleft: 6px;
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom: 1px solid #afafaf
}
nav ul li a: hover {
padding: 13px 20px;
color: green
}
nav ul ul {
padding: 0;
position: absolute
}
nav ul ul li {
float: none;
position: relative;
border: 1px solid #afafaf;
border-bottom: 1px solid #b7b7b7;
border-top: 1px solid #fff;
background: -webkit-linear-gradient(#eee 0,#d4d4d4 100%);
background: linear-gradient(#eee 0,#d4d4d4 100%);
background: -moz-linear-gradient(#eee 0,#d4d4d4 100%);
background: -o-linear-gradient(#eee 0,#d4d4d4 100%);
-moz-box-shadow: inset 2px 2px 5px #ccc;
-webkit-box-shadow: inset 2px 2px 5px #ccc;
box-shadow: inset 2px 2px 5px #ccc;
filter: progid: DXImageTransform.Microsoft.Shadow(color=#ccc,Direction=134,Strength=5);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee',endColorstr='#d4d4d4')
}
nav ul ul li a {
padding: 13px 20px;
color: #063058
}
nav ul li: hover>ul {
visibility: visible;
opacity: 1;
-moz-opacity: 1;
-webkit-opacity: 1
}
nav ul li {
float: left
}
#topmenu li a: hover {
color: #fff
}
#topmenu li a: hover {
color: green;
background: -webkit-linear-gradient(#eee 0,#d4d4d4 100%);
background: linear-gradient(#eee 0,#d4d4d4 100%);
background: -moz-linear-gradient(#eee 0,#d4d4d4 100%);
-moz-box-shadow: inset 2px 2px 5px #ccc;
-webkit-box-shadow: inset 2px 2px 5px #ccc;
box-shadow: inset 2px 2px 5px #ccc;
filter: progid: DXImageTransform.Microsoft.Shadow(color=#ccc,Direction=134,Strength=5);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee',endColorstr='#d4d4d4')
}
nav ul li a {
display: block;
padding: 13px 20px;
color: white
}
nav ul ul ul {
position: absolute;
left: 100%;
top: 0
}
This works
#topmenu li:hover a {
background: linear-gradient(#EEEEEE 0px, #D4D4D4 100%) repeat scroll 0 0 transparent;
box-shadow: 2px 2px 5px #CCCCCC inset;
color: green;
}
I`ve just copied your code there.
I can't get your website to load so i've just done this fiddle for you with lots of comments expalaining the CSS
I have done this fiddle for you http://jsfiddle.net/kevinPHPkevin/PknRT/
nav ul ul {
display: none;
}