The submenu is not displaying under the parent item, whereas on the left. Tried to take the absolute off, and on, but it does not seem to make any effect.
JS fiddle here: http://jsfiddle.net/42qg5/
HTML
<div id="menu">
<div class="container">
<ul>
<li>Home
</li>
<li>About SRJC
</li>
<li>Admission
</li>
<li>The SR Programmes
</li>
<li>CCAs
</li>
<li>Portals
<ul class="submenu">
<li>ASPIRE
</li>
</ul>
</li>
<li>Staff & Parents
</li>
</ul>
</div>
</div>
CSS
#menu ul li ul li {
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
margin: 0;
padding: 0;
border: none;
outline: none;
}
Here is updated Fiddle with code.
Fiddle
#menu ul li ul {
padding-left: 10px;
padding-right: 10px;
height: auto;
width: 100px;
background-color: #e13393;
border-bottom: 2px solid #fcc402;
display: none;
z-index: 999;
position:absolute;
left:0;
top:30px;
}
#menu li {
display: inline;
color: #fff;
position:relative;
}
Related
My page no longer applies the :hover effect to my .tabs li element, but I can't for the life of me figure out why. I commented out my jQuery script and it still won't work.
Here's a JSFiddle: https://jsfiddle.net/qpmg4wzq/
<div id="tabs-container">
<ul class="tabs">
<li class="tab current" data-tab="tab-1">tab 1</li>
<li class="tab" data-tab="tab-2">tab 2</li>
<li class="tab" data-tab="tab-3">tab 3</li>
<li class="tab" data-tab="tab-4">tab 4</li>
</ul>
</div>
#tabs-container {
float: left;
width: 100%;
overflow: hidden;
}
.tabs {
padding: 0px;
list-style: none;
clear: left;
float: left;
left: 50%;
}
.tabs li {
display: block;
float: left;
right: 50%;
margin: 0;
padding: 10px 20px 5px 20px;
cursor: pointer;
font-size: 1.1em;
line-height: 2em;
-webkit-transition: color .2s linear;
-moz-transition: color .2s linear;
-ms-transition: color .2s linear;
-o-transition: color .2s linear;
transition: color .2s linear;
-webkit-transition: background .2s linear;
-moz-transition: background .2s linear;
-ms-transition: background .2s linear;
-o-transition: background .2s linear;
transition: background .2s linear;
}
.tabs li:hover {
background: #88abc2!important;
}
.tabs li.current {
background: #d0e0eb;
color: #49708a;
}
.tab-content {
display: none;
padding: 15px;
line-height: 1.4;
}
.tab-content.current {
display: inherit;
}
Thanks.
Your .tab-content is overlapping the .tabs-container so any :hover action you make is actually registering as a hover on the .tab-content element.
A couple of options to solve this
Move the tab-content down using margin-top
.tab-content.current {
display: inherit;
margin-top: 60px;
}
Remove float: left from #tabs-container
I am creating a demo for my homework.
My navigation is not displaying correctly. I have been trying to fix the problem in many ways but none of them work.
demo
here is my demo
<body>
<div class="container">
<div class="content">
<div id="menu">
<ul class="parent-menu">
<li>
Home & Kitchen
<ul>
<li>item</li>
<li>item</li>
</ul>
</li>
<li>
Electronics
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
</li>
<li>
Clothing
<ul>
<li>item</li>
<li>item</li>
<
</ul>
</li>
<li>
Cars & Motorbikes
<ul>
<li>item</li>
<li>item</li>
<
</ul>
</li>
<li>
Books
<ul>
<li>item</li>
<li>item</li>
</ul>
</li>
<li>
Support
<ul>
<li>
Contact Us
</li>
<li>
Forum
</li>
<li>Deliveries</li>
<li>T&C</li>
</ul>
</li>
</ul>
</div>
<!-----------Shorcut Panel Content--------->
<div class="shortcutpanel">
<div class="usergroup">
</div>
</div>
</div>
</body>
Here is my CSS code.
/* Basic Style */
html, body{
height:100%;
}
body {
background-color: grey;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
background-size:cover;
}
/*Global Setting*/
.hover{
float:left;
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
overflow: hidden;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: color, background-color;
transition-property: color, background-color;
}
.hover:active, .hover:hover, .hover:focus{
background-color: rgba(32, 152, 209, 0.5);
}
.container{
height:100%;
width:100%;
}
.content{
position:fixed;
top:10%;
left:0%;
height:90%;
width:100%;
}
/* NAVIGATION*/
p, ul, li, div, nav { padding:0; margin:0; }
#menu {
overflow: hidden;
position:fixed ;
left:0%;
top:20%;
z-index:999; }
.parent-menu {
background-color: #0c8fff;
width:180px; }
#menu ul {
list-style-type:none;
}
#menu ul li a {
padding:10px 15px;
display:block;
color:#fff;
text-decoration:none;
}
#menu ul li a:hover {
background-color:#007ee9;
}
#menu ul li:hover > ul {
left: 200px;
-webkit-transition: left 200ms ease-in;
-moz-transition: left 200ms ease-in;
-ms-transition: left 200ms ease-in;
transition: left 200ms ease-in;
}
#menu ul li > ul {
position: absolute;
background-color: #333;
top: 0;
left: -200px;
min-width: 200px;
z-index: 999;
height: 100%;
-webkit-transition: left 200ms ease-in;
-moz-transition: left 200ms ease-in;
-ms-transition: left 200ms ease-in;
transition: left 200ms ease-in;
}
#menu ul li > ul li a:hover {
background-color:#2e2e2e;
}
#menu ul li a:focus + ul {
left: 200px;
-webkit-transition: left 200ms ease-in;
-moz-transition: left 200ms ease-in;
-ms-transition: left 200ms ease-in;
transition: left 200ms ease-in;
}
/* Shortcut Panel Content */
.shortcutpanel{
position:relative;
left:10%;
top:5%;
height:90%;
width:30%;
float:left;
margin:0;
padding:0;
background-color:rgba(255,240,240,0.1);
}
Here this Demo,its the navigation effect that i want.
But however in my first demo.When you hover over the navi menu, the 2nd level menu will come out but display incorrectly. I don't know how to solve this.
Thanks for helps guys
If i get your question right.. U can do that by width animation..
And change :focus to :hover + ul
DEMO FIDDLE
#menu ul li:hover > ul {
left: 200px;
width: 200px;
}
#menu ul li > ul {
width: 0px;
}
#menu ul li a:hover + ul {
width: 200px;
-webkit-transition: width 300ms ease-in;
-moz-transition: width 300ms ease-in;
-ms-transition: width 300ms ease-in;
transition: width 300ms ease-in;
}
Hope it helps..
Good day to all!
I need help to modify a CSS navigation menu with dropdowns to add sub-menu to it.
For example, I have menu options "You" -> "Plan". I need to add a sub-menu into "Plan", so when user hovers the cursor over "Plan", a sub-menu with other options appears - just like when he hovers over "You" option.
HTML:
<nav>
<ul>
<li>View</li>
<li class="drop">
You
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Plan</li>
<li>Account Settings</li>
<li>Switch Account</li>
<li>Sign Out</li>
</ul>
</div>
</div>
</li>
<li>Help</li>
</ul>
</nav>
CSS:
body {
text-align: center;
background: #e0e0e0;
padding-bottom: 200px;
}
a {
text-decoration: none;
}
/*---------- Wrapper --------------------*/
nav {
width: 100%;
height: 80px;
background: #222;
}
ul {
text-align: center;
}
ul li {
font: 13px Verdana, 'Lucida Grande';
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}
ul li.drop {
position: relative;
}
ul > li {
display: inline-block;
}
ul li a {
line-height: 80px;
padding: 0 20px;
height: 80px;
color: #777;
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
ul li a:hover {
color: #eee;
}
.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain {
width: 160px;
position: absolute;
z-index: 2;
left: 50%;
margin-left: -80px; /* half of width */
top: -400px;
}
.dropOut {
width: 160px;
background: white;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
.dropOut ul {
float: left;
padding: 10px 0;
}
.dropOut ul li {
text-align: left;
float: left;
width: 125px;
padding: 12px 0 10px 15px;
margin: 0px 10px;
color: #777;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
transition: background .1s ease-out;
}
.dropOut ul li:hover {
background: #f6f6f6;
}
ul li:hover a { color: white; }
ul li:hover .dropdownContain { top: 65px; }
ul li:hover .underline { border-bottom-color: #777; }
ul li:hover .dropOut { opacity: 1; margin-top: 8px; }
Any help would be appreciated!
You just need to add another ul for your subnav set to position:absolute and display: none and then show it when you hover over .dropOut ul li
.subnav{
display:none;
background: black;
position: absolute;
left: 100%;
top: 0;
}
.dropOut ul li:hover .subnav{
display: block;
}
Just be sure to set .dropOut ul li to position: relative so that it will contain your subnav:
.dropOut ul li {
position: relative; //add
text-align: left;
float: left;
width: 125px;
....
HTML
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Plan
<ul class="subnav">
<li>menu 1</li>
<li>menu 1</li>
<li>menu 1</li>
</ul>
</li>
<li>Account Settings</li>
<li>Switch Account</li>
<li>Sign Out</li>
</ul>
</div>
</div>
FIDDLE
You shouldn't use opacity to do this use display instead i have did this using opacity but that leaves some space use display property to avoid this http://jsfiddle.net/k2rjkdxy/ This one with display http://jsfiddle.net/k2rjkdxy/1/
body {
text-align: center;
background: #e0e0e0;
padding-bottom: 200px;
}
a {
text-decoration: none;
}
/*---------- Wrapper --------------------*/
nav {
width: 100%;
height: 80px;
background: #222;
}
ul {
text-align: center;
}
ul li {
font: 13px Verdana, 'Lucida Grande';
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}
ul li.drop {
position: relative;
}
ul > li {
display: inline-block;
}
ul li a {
line-height: 80px;
padding: 0 20px;
height: 80px;
color: #777;
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
ul li a:hover {
color: #eee;
}
.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain {
width: 160px;
position: absolute;
z-index: 2;
left: 50%;
margin-left: -80px; /* half of width */
top: -400px;
}
.dropOut {
width: 160px;
background: white;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
.dropOut ul {
float: left;
padding: 10px 0;
}
.dropOut ul li {
text-align: left;
float: left;
width: 125px;
padding: 12px 0 10px 15px;
margin: 0px 10px;
color: #777;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
transition: background .1s ease-out;
}
.dropOut ul li:hover {
background: #f6f6f6;
}
ul li:hover a { color: white; }
ul li:hover .dropdownContain { top: 65px; }
ul li:hover .underline { border-bottom-color: #777; }
ul li:hover .dropOut { opacity: 1; margin-top: 8px; }
.d{
opacity:0;
}
ul li ul li:hover .d{
opacity:1;
}
<nav>
<ul>
<li>View</li>
<li class="drop">
You
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Plan
<ul class="d"><li>text</li>
<li>text</li>
<li>text</li>
</ul></li>
<li>Account Settings</li>
<li>Switch Account</li>
<li>Sign Out</li>
</ul>
</div>
</div>
</li>
<li>Help</li>
</
This one with display property
body {
text-align: center;
background: #e0e0e0;
padding-bottom: 200px;
}
a {
text-decoration: none;
}
/*---------- Wrapper --------------------*/
nav {
width: 100%;
height: 80px;
background: #222;
}
ul {
text-align: center;
}
ul li {
font: 13px Verdana, 'Lucida Grande';
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}
ul li.drop {
position: relative;
}
ul > li {
display: inline-block;
}
ul li a {
line-height: 80px;
padding: 0 20px;
height: 80px;
color: #777;
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
ul li a:hover {
color: #eee;
}
.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain {
width: 160px;
position: absolute;
z-index: 2;
left: 50%;
margin-left: -80px; /* half of width */
top: -400px;
}
.dropOut {
width: 160px;
background: white;
float: left;
position: relative;
margin-top: 0px;
display:none;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
.dropOut ul {
float: left;
padding: 10px 0;
}
.dropOut ul li {
text-align: left;
float: left;
width: 125px;
padding: 12px 0 10px 15px;
margin: 0px 10px;
color: #777;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
transition: background .1s ease-out;
}
.dropOut ul li:hover {
background: #f6f6f6;
}
ul li:hover a { color: white; }
ul li:hover .dropdownContain { top: 65px; }
ul li:hover .underline { border-bottom-color: #777; }
ul li:hover .dropOut { display:block; margin-top: 8px; }
.d{
display:none;
}
ul li ul li:hover .d{
background:skyblue;
position:absolute;
display:block;
}
<nav>
<ul>
<li>View</li>
<li class="drop">
You
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Plan
<ul class="d"><li>text</li>
<li>text</li>
<li>text</li>
</ul></li>
<li>Account Settings</li>
<li>Switch Account</li>
<li>Sign Out</li>
</ul>
</div>
</div>
</li>
<li>Help</li>
</
I am new to css and html.
I have developed a menu and trying to do drop down menu after keeping the cursor on a menu item.
But i have referred a site.
http://cssdeck.com/labs/another-simple-css3-dropdown-menu but still the same problem.
HTML
<div class="main-content">
<div class="bar">
<header>
<!--<h1 class="header">Dead Stocker
</h1>-->
<nav>
<ul>
<li>HOME</li>
<li>
Membership
<ul>
<li>Web Design</li>
<li>Web Development</li>
<li>Illustrations</li>
</ul>
</li>
<li>Facilities</li>
<li>Events</li>
<li>Gallery</li>
<li>Notice Board</li>
<li>Contact Us</li>
</ul>
</nav>
<img src="images/fb.png"/>
<img src="images/twitter.png"/>
<img src="images/rss.png"/>
<p>SUBSCRIBE</p>
</header>
</div>
CSS
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 a :hover ul{
display: block;
opacity: 1;
visibility: visible;
}
Can anyone help me out to solve this problem ?
Just you have to change a bit in css
old css
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 a :hover ul{
display: block;
opacity: 1;
visibility: visible;
}
replace by this one
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: 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 a :hover ul{
opacity: 1;
visibility: visible;
}
Hope this will work for you.
i'm fairly new to html and I need to create a basic website for my college assignment but I want to go a step up from what everyone is doing and rather then creating a basic navigation menu I decided to create something more interesting and fun, a drop down navigation menu with changing colors and transition effects (HERE IS THE ISSUE) - BUT when i hover over menu the lists do not appear.. here is my html/css codes for that section:
<ul id="navmenu">
<li>Menu</li>
<ul>
<li>Education</li>
<li>Hobbies</li>
<li>Interests</li>
</ul>
</ul>
ul
{
list-style-type: none;
}
#navmenu a {
text-decleration: none;
display: block;
width: 125px;
height: 25px;
line-height: 25px;
background-color: ;
border: 1px solid #CCC;
border-radius: 5px;
font-family: Magneto;
font-size: 20px;
color: ffffff;
transition: ease-in all 400ms;
-moz-transition: ease-in all 300ms;
-webkit-transition: ease-in all 300ms;
-o-transition: ease-in all 300ms;
}
#navmenu ul {
display: none;
}
#navmenu li:hover ul {
display: block;
}
#navmenu li:hover > a {
background-color: #535ffb;
transition: ease-in all 300ms;
-moz-transition: ease-in all 300ms;
-webkit-transition: ease-in all 300ms;
-o-transition: ease-in all 300ms;
position: relative;
left: 10px;
}
#navmenu a {
margin-top: 3px;
}
Probably because your second ul is not nested under the menu item. Try this:
ul {
list-style-type: none;
}
#navmenu a {
text-decleration: none;
display: block;
width: 125px;
height: 25px;
line-height: 25px;
background-color: ;
border: 1px solid #CCC;
border-radius: 5px;
font-family: Magneto;
font-size: 20px;
color: ffffff;
transition: ease-in all 400ms;
-moz-transition: ease-in all 300ms;
-webkit-transition: ease-in all 300ms;
-o-transition: ease-in all 300ms;
}
#navmenu ul {
display: none;
}
#navmenu li:hover ul {
display: block;
}
#navmenu li:hover > a {
background-color: #535ffb;
transition: ease-in all 300ms;
-moz-transition: ease-in all 300ms;
-webkit-transition: ease-in all 300ms;
-o-transition: ease-in all 300ms;
position: relative;
left: 10px;
}
#navmenu a {
margin-top: 3px;
}
<ul id="navmenu">
<li>
Menu
<ul>
<li>Education
</li>
<li>Hobbies
</li>
<li>Interests
</li>
</ul>
</li>
</ul>