Adding transition to a dropdown - html

I'm not sure if this can be done that way it was built but I'd like to add a transition effect to my dropdown. Anything that would make it seem less choppy. SLide, fade etc. Codepen below.
<div id="nav-wrap">
<ul>
<li id="link-one" class="orange">
<span>Test</span>
<div class="subnav">
<ul>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>
</div><!-- /.subnav -->
</li>
<li class="red"><span>Test</span></li>
<li class="pink"><span>Test</span></li>
<li class="purple"><span>Test</span></li>
<li class="blue"><span>Test</span></li>
<li class="green"><span>Test</span></li>
<li class="yellow-facebook"><span></span></li>
</ul>
</div> <!-- nav-wrap -->
#nav-wrap .doubleLine {
display: table-cell;
line-height: 1.2em;
width:65.275%;
}
#nav-wrap {
width:100%;
height:100px;
font-weight:500;
padding: 0;
left:0;
font-family: 'Raleway', Arial, sans-serif;
z-index:100;
float:left;
}
#nav-wrap ul {
list-style-type: none;
margin: 0;
padding:0;
text-transform: uppercase;
}
#nav-wrap ul li {
width:14.275%; /* ~(100/7) */
display:block;
float:left;
text-align:center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#nav-wrap ul li + li {
border-left: 1px #fff solid !important;
}
#nav-wrap ul li a {
width:100%;
display: block;
height: 100%;
position: relative;
color:#FFFFFF !important;
text-decoration:none;
}
#nav-wrap ul li span {
display: inline-block;
vertical-align: middle;
height: 100px;
font-size:1.45em;
text-align: center;
padding: 0 5% 0 5%; /* was 0 20px */
line-height: 100px;
}
#nav-wrap ul li.yellow-facebook {
width:14.275%;
}
#nav-wrap ul li.yellow-facebook a {
background-size:130px 26px; /* > 25px */
}
li .subnav {
display: none;
/*position: absolute; */
clear: both;
margin-left: 0;
font-size:0.9em;
}
.subnav ul {
margin-left: 0;
float:left;
padding:0;
width:100%;
}
.subnav ul li {
margin: 0 0 0 0;
width:100% !important;
height:23px;
float:none !important;
}
.subnav ul li a {
padding: 10px 0 3px 0;
/*background-image: url(../images/submenu-background-divider.png);
background-repeat:no-repeat;
background-position:left;*/
}
#nav-wrap .subnav ul li + li {
border-left: none !important;
}
.subnav {
width:100%;
padding: 0;
margin: 0.05% 0 0 0;
border-top:#FFF 1px solid;
}
.subnav ul li a:link, a:active, a:visited {
text-decoration:none;
}
.subnav ul li a:hover {
color:#000;
text-decoration:none;
}
li:hover > .subnav {display:inline-block; left:0;}
#nav-wrap ul li.orange a {
background-color:#f37028;
}
#nav-wrap ul li.orange a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.red a {
background-color:#ed1b24;
}
#nav-wrap ul li.red a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.pink a {
background-color:#e54198;
}
#nav-wrap ul li.pink a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.purple a {
background-color:#6b439c;
}
#nav-wrap ul li.purple a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.blue a {
background-color:#0193cf;
}
#nav-wrap ul li.blue a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.green a {
background-color:#80c02c;
}
#nav-wrap ul li.green a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.yellow-facebook a {
background-color:#fff300;
background-image:url(../images/social-media/facebook-text.png);
background-repeat:no-repeat;
background-position:center;
}
#nav-wrap ul li.yellow-facebook a:hover {
color: #231f20;
background-image:url(../images/social-media/facebook-text_over.png);
}
http://codepen.io/Compton/pen/jLGyo/

You can try a CSS3 transition, only you would have to use opacity instead of display none.
add this
li:hover > .subnav {
display:inline-block;
left:0;
-webkit-transition: all 0.4s ease-in;
-moz-transition: all 0.4s ease-in;
-o-transition: all 0.4s ease-in;
transition: all 0.4s ease-in;
opacity:1.0;
}
and change the display none to this:
li .subnav {
opacity:0;
/*position: absolute; */
clear: both;
margin-left: 0;
font-size:0.9em;
}
Jquery can do some sliding if you'd rather, but this is a little simpler to set up, you can also adjust the height to make it slide down if youd rather that instead of a fade in.

Put this to the animated element CSS:
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
-webkit-perspective: 1000;
It basically fools browser that the transition or animation is 3D and enables GPU acceleration and disables two-sided planes in webkit based browsers.

Related

How can i add the bottom border animation in my website?

I ran into a problem which I need to solve to present the Website.
The border when I hover my menu isn't moving upwards, only my font moves up a bit.
.srt-menu li a {
transition: 0.3s ease;
background: #3fa46a;
color: red;
font-size: 20px;
text-decoration: none;
padding: 0px 0;
margin: 0 0px;
}
.srt-menu li a:hover{
transition: 0.3s ease;
background: transparent;
color: #1aa8a4;
text-decoration: none;
border-top: 1px solid red;
border-bottom: 4px solid #3fa46a;
padding: 0px 0;
margin: 0 0px;
}
.srt-menu li li a {
background:#e8e8e8;
padding-left:40px;
}
.srt-menu li li li a {
background:#efefef;
padding-left:80px;
}
/*SECONDARY MENU*/
#secondary-navigation{
margin-bottom:60px;
}
``#secondary-navigation ul{
margin:0;
padding:0;
}
#secondary-navigation ul li a{
background:#E6E6E6;
display:block;
margin:5px 0;
padding:10px;
text-decoration:none;
}
#secondary-navigation ul li a:hover,
#secondary-navigation ul li.current a{
transition: 0.3s ease;
background: red;
color: #ffffff;
text-decoration: none;
border-top: 0px solid transparent;
border-bottom: 4px solid #3fa46a;
padding: 24px 0;
}
/*SPACE GRID ELEMENTS VERTICALLY, SINCE THEY ARE ONE UNDER ANOTHER SO FAR*/
.grid_1,
.grid_2,
.grid_3,
.grid_4,
.grid_5,
.grid_6,
.grid_7,
.grid_8,
.grid_9,
.grid_10,
.grid_11,
.grid_12 {
margin-bottom:40px;
/*positioning and padding*/
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
}
/*FOOTER*/
footer{
clear:both;
font-size:80%;
padding:20px 0;
}
footer ul{
margin:0;
padding:0;
}
/*colors and backgrounds*/
body{
background:#fff;
}
h1, h2, h3, h4, h5, h6{
color:#333;
}
footer{
background:#333;
color:#ccc;
}
footer h1, footer h2, footer h3, footer h4{
color:#CCC;
margin-bottom:10px;
}
footer ul{
margin:0 0 0 8%;
}
a.buttonlink{
background:#0099ff;
border-radius:7px;
color:#fff;
display:block;
float:left;
margin:10px 15px 10px 0;
padding:10px;
text-decoration:none;
}
a.buttonlink:hover{
background:#8dbc01;
}
.greenelement{
background:#5ec79e;
color:#fff;
}
.violetelement{
background:#887dc2;
color:#fff;
}
/* Contain floats*/
.clearfix:before,
.clearfix:after,
.row:before,
.row:after {
content: " ";
display: table;
}
.clearfix:after,
.container:after,
.row:after{
clear: both;
}
aside {
float:right;
width:30%;
}
/*** MAIN MENU - ESSENTIAL STYLES ***/
.menu-toggle{display:none;}
#menu-main-navigation{display:block;}
.srt-menu, .srt-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.srt-menu ul {
position: absolute;
display:none;
width: 12em; /* left offset of submenus need to match (see below) */
}
.srt-menu ul li {
width: 100%;
}
.srt-menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.srt-menu li {
float: left;
position: relative;
margin-left:1px;
}
.srt-menu li li {
margin-left:0px;
}
.srt-menu a {
display: block;
position: relative;
}
.srt-menu li:hover ul,
.srt-menu li.sfHover ul {
display:block;
left: 0;
top: 45px; /* match top ul list item height */
z-index: 99;
-webkit-box-shadow: 2px 3px 2px 0px rgba(00, 00, 00, .3);
box-shadow: 2px 3px 2px 0px rgba(00, 00, 00, .3);
}
ul.srt-menu li:hover li ul,
ul.srt-menu li.sfHover li ul {
top: -999em;
}
ul.srt-menu li li:hover ul,
ul.srt-menu li li.sfHover ul {
left: 12em; /* match ul width */
top: 0;
}
ul.srt-menu li li:hover li ul,
ul.srt-menu li li.sfHover li ul {
top: -999em;
}
ul.srt-menu li li li:hover ul,
ul.srt-menu li li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
/*** DEMO1 SKIN ***/
#topnav, .srt-menu {
float:right;
margin: .35em 0 0 0;
}
.srt-menu a {
text-decoration:none;
}
.srt-menu li a {
background:#fff;
margin:0;
padding:10px 20px;
height:45px;
}
.srt-menu a, .srt-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
color: #0099ff;
}
.srt-menu li li a {
border-top: 1px solid rgba(255,255,255,.2);
background: #333; /*fallback for old IE*/
background:rgba(0,0,0,.6);
color: #fff;
padding-left:20px;
height:auto;
}
.srt-menu li li a:visited{color:#fff;}
.srt-menu li li li a,
.srt-menu li.current * li a{
padding-left:20px;
background:rgba(0,0,0,.6);
}
.srt-menu li:hover > a,
transition: 0.3s ease;
background: transparent;
color: #1aa8a4;
text-decoration: none;
border-top: 0px solid transparent;
border-bottom: 4px solid #3fa46a;
padding: 24px 0;
}
.srt-menu li li:hover > a{
color:green;
background:#0099ff;
}
<nav id="topnav" role="navigation">
<div class="menu-toggle">Menu</div>
<ul class="srt-menu" id="menu-main-navigation"><li class="current">Start<ul><li>Test</li></ul></li><li>Kontakt</li><li>Öffnungszeiten</li><li>Anfahrt</li><li>testststst</li></ul> </nav><!-- #topnav -->
<!-- main content area -->
<div class="wrapper" id="main">
Take a look on my website where you can see the problem in action.
How can I create the menu look like here?
I want the bottom border to move in when I hover on it, and move out when I leave the "button".
The example you are trying to copy is not structured the same way your site is.
On :hover, You can simply add a box-shadow for the bottom:
box-shadow: 0 4px 2px -2px gray;

Slide in border from left to right, when hovering UL menu

I want this border to slide in from left to right(dropmenus only). But can't figure it out
This is how I got so far, I don't have any ideas no more.
Menu is built with ul and li-s.
Is this possible?
Thanks,
.toggle,
[id^=drop] {
display: none;
}
.toggle_menu,
[id^=drop] {
display: none;
}
nav:after {
content:"";
display:table;
clear:both;
}
nav ul {
padding:0;
margin:0;
list-style: none;
position: relative;
}
nav ul li.active_link a{
font-size:14px;
text-decoration:none;
font-family: 'Lato';
font-weight:600;
}
nav ul li {
margin: 0px;
display:inline-block;
float: left;
background-color: white;
}
nav a {
display:block;
padding: 14px 16px;
color:#FFF;
font-size:14px;
text-decoration:none;
color:black;
font-family: 'Lato';
font-weight:400;
}
nav ul li ul li:hover { /*background: #000000; */}
nav a:hover {
/*background-color: #000000;*/
}
nav ul li ul{
display: none;
position: absolute;
color: #31302B;
background: #FFF;
cursor: pointer;
box-shadow: inset 0 0 0 0 #b6945d;
-webkit-transition: all ease 1s;
-moz-transition: all ease 1s;
transition: all ease 1s;
}
nav ul li:hover > ul{
box-shadow: inset 900px 0px 0px #b6945d;
color: #fff;
}
nav ul li:hover > ul {
display:inherit;
}
nav ul ul li {
background-color: transparent;
width: auto;
float: left;
display: list-item;
position: relative;
}
nav ul ul ul li {
position: relative;
top:-60px;
left:170px;
}
nav ul li ul li a{
font-style: italic;
background-color: white;
margin-top: 1px;
}
nav ul li ul li a:hover{
font-style:italic;
color:#b6945d;
}
/*li > a:after { content: ' +'; }*/
li > a:only-child:after { content: ''; }
<nav>
<label for="drop" class="toggle_menu"><img src="assets/images/mobile_button.png"></label>
<input type="checkbox" id="drop" />
<ul class="menu">
<li class="active_link">
Avaleht
</li>
<li>
<label for="drop-1" class="toggle">Kunstnik</label>Kunstnik
<input type="checkbox" id="drop-1"/>
<ul>
<li>Kunstnikust</li>
<li>Tööde arhiiv</li>
</ul>
</li>
<li>
<label for="drop-2" class="toggle">E-pood</label>E-pood
<input type="checkbox" id="drop-2"/>
<ul>
<li>Kõik tooted</li>
<li>Seeriatooted</li>
</ul>
</li>
</ul>
</nav>
I have added 10 line css below: Are you looking for this:
.toggle,
[id^=drop] {
display: none;
}
.toggle_menu,
[id^=drop] {
display: none;
}
nav:after {
content:"";
display:table;
clear:both;
}
nav ul {
padding:0;
margin:0;
list-style: none;
position: relative;
}
nav ul li.active_link a{
font-size:14px;
text-decoration:none;
font-family: 'Lato';
font-weight:600;
}
nav ul li {
margin: 0px;
display:inline-block;
float: left;
background-color: white;
}
nav a {
display:block;
padding: 14px 16px;
color:#FFF;
font-size:14px;
text-decoration:none;
color:black;
font-family: 'Lato';
font-weight:400;
}
nav ul li ul li:hover { /*background: #000000; */}
nav a:hover {
/*background-color: #000000;*/
}
nav ul li ul{
display: none;
position: absolute;
color: #31302B;
background: #FFF;
cursor: pointer;
box-shadow: inset 0 0 0 0 #b6945d;
-webkit-transition: all ease 1s;
-moz-transition: all ease 1s;
transition: all ease 1s;
}
nav ul li:hover > ul{
box-shadow: inset 900px 0px 0px #b6945d;
color: #fff;
}
nav ul li:hover > ul {
display:inherit;
}
nav ul ul li {
background-color: transparent;
width: auto;
float: left;
display: list-item;
position: relative;
}
nav ul ul ul li {
position: relative;
top:-60px;
left:170px;
}
nav ul li ul li a{
font-style: italic;
background-color: white;
margin-top: 1px;
}
nav ul li ul li a:hover{
font-style:italic;
color:#b6945d;
}
/*li > a:after { content: ' +'; }*/
li > a:only-child:after { content: ''; }
/**New css for transition**/
nav ul li ul:after {
content: '';
display: block;
border-bottom: 4px solid red;
width: 0;
position: absolute;
left: 0;
-webkit-transition: 1s ease;
transition: 1s ease;
}
nav ul li ul:hover:after {
width: 100%;
}
<nav>
<label for="drop" class="toggle_menu"><img src="assets/images/mobile_button.png"></label>
<input type="checkbox" id="drop" />
<ul class="menu">
<li class="active_link">
Avaleht
</li>
<li>
<label for="drop-1" class="toggle">Kunstnik</label>Kunstnik
<input type="checkbox" id="drop-1"/>
<ul>
<li>Kunstnikust</li>
<li>Tööde arhiiv</li>
</ul>
</li>
<li>
<label for="drop-2" class="toggle">E-pood</label>E-pood
<input type="checkbox" id="drop-2"/>
<ul>
<li>Kõik tooted</li>
<li>Seeriatooted</li>
</ul>
</li>
</ul>
</nav>
Now it works.
.menu {
width: 100%;
height: auto;
background: white;
transition: all 0.3s ease;
}
.menu ul {
padding: 0px;
margin: 0px;
list-style: none;
position: relative;
display: inline-block;
width:100%;
}
.menu > li > ul.sub_menu {
min-width: 10em;
padding: 4px 0;
background-color: #f4f4f4;
border: 1px solid #fff;
}
.menu ul li { padding: 0px; }
.menu ul li.active a{
font-weight:600;
}
.second_menu ul li.active a{
font-weight:600;
}
.menu > ul > li { display: inline-block; }
.menu ul li a {
display: block;
text-decoration: none;
color: black;
font-family: 'Lato';
font-weight:400;
font-size:14px;
}
.menu ul li a:hover {
color: black;
}
.menu ul li.hover > a {
color: black;
}
.menu ul li > a { padding: 15px; }
.menu ul ul {
visibility: hidden;
position: absolute;
top: 100%;
width:auto;
background: white;
}
.menu ul li.active_drop a{
font-weight:600 !important;
color:#b6945d;
}
.menu ul li ul.dropdown_nav li a{
font-weight:400;
}
.menu ul li.active_drop a:hover{
color:#b6945d;
}
.menu ul li:hover > ul {
visibility: visible;
}
.menu ul ul > li {
position: relative;
display: inline;
float: left;
width: auto;
}
.menu ul ul > li a {
padding: 10px 15px;
height: auto;
background: white;
font-style:italic;
}
.menu ul ul > li a:hover {
color: black;
}
.menu ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
/* animating the golden border */
.dropdown_nav {
position: relative;
overflow: hidden;
}
.dropdown_nav:before {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 1px;
content: "";
background-color: #b6945d;
z-index: 1;
transition: transform .5s ease-out;
transform: translateX(-100%);
}
.menu>ul>li:hover .dropdown_nav:before {
transform: translateX(0);
}
<nav id="menu" class="menu">
<ul class="dropdown">
<li>leht</li>
<li class="active">
leht1
<ul class="dropdown_nav">
<li class="dropdown_first active_drop">
leht1.1</li>
<li class="dropdown_last">leht1.2</li>
</ul>
</li>
<li>
leht2
<ul class="dropdown_nav">
<li class="dropdown_first">leht2.1</li>
<li>leht2.2</li>
</ul>
</li>
<li>leht3</li>
<li>leht4</li>
</ul>
</nav>

CSS menu transition - li elements are excluded from the effect

I'm concluding a design and I'm facing an issue which I'm not familiar with. I'm trying to make a menu expand from hidden to visible over 2 seconds on hover using a transition: height CSS element.
The issue is that the ul is obeying the transition and appearing visible within 2s, however the lis are completely ignoring the transition effect and instantly expanding on hover.
CSS syntax below:
#main_navbar_container{
margin-bottom:0;
background:white;
}
.navbar-collapse {
text-align:center;
}
#menu_container{
width:80%;
float:right;
display:block;
}
#primary_menu{
display:block;
float:left;
width:100%;
}
#primary_menu ul{
list-style: none;
margin: 0;
padding-left: 0;
}
#primary_menu a,
#primary_menu a:visited,
#primary_menu a:link{
color:#ea474b;
font-weight: 600;
display: block;
text-decoration: none;
padding: 15px 20px;
margin:auto;
}
#primary_menu a:hover{
color:#F9690E;
}
#primary_menu li{
float:left;
position:relative;
margin:0
}
#primary_menu ul ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
border-radius: 4px;
border: 1px solid #dadada;
background: #fff;
color: #8c9398;
float: right;
position: absolute;
top: 3.5em;
right: -999em;
z-index: 99999;
text-align: center
}
#primary_menu ul li:hover > ul {
right: 50%;
margin-right: -100%;
width: 200px;
}
.sub-menu li{
margin:0 15px !important;
}
#primary_menu ul li ul a{
color:#ea474b;
}
#primary_menu ul li ul:hover a{
color:#ea474b;
}
#primary_menu ul li ul li:hover a{
color:#F9690E;
}
#media (max-width: 1200px){
#main_navbar_container .container, #menu_container { width: 100%;}
#menu_container .navbar-collapse { padding: 0;}
#primary_menu{
width:100%;
margin:0;
}
#primary_menu li{
width:100%;
margin:5px 0 0 0;
}
#primary_menu ul li ul {
border-radius: 0 !important;
border-color: transparent !important;
display:hidden;
height:100px;
-webkit-transition: height 2s; /* Safari */
transition: height 2s;
}
#primary_menu ul li:hover{
background:none;
}
#primary_menu ul li:hover a{
font-color:black;
/*\color:rgb(207,0,15);*/
}
#primary_menu ul li:hover ul{
position:initial;
display:block;
background-color:rgb(238,238,238);
width:100%;
padding:0;
margin:0;
height:400px;
}
#primary_menu ul li:hover li:first-of-type{
border-top:1px solid rgb(238,238,238);
}
#primary_menu ul li:hover li:last-of-type{
border-bottom:1px solid rgb(238,238,238);
}
#primary_menu ul li:hover a:link,
#primary_menu ul li:hover a:visited{
color:#ea474b;
}
#menu-home-screen-menu{
margin-left:0;
}
}
Here is a fiddle: http://jsfiddle.net/x15jw967/
A few things help here. First, transition max-height instead of height to allow variation:
#primary_menu ul li ul {
...
max-height:0;
-webkit-transition: max-height 2s;
transition: max-height 2s;
}
#primary_menu ul li:hover ul {
...
max-height: 400px;
}
Then, set overflow to hidden so the outer content doesn't show:
#primary_menu ul li ul {
...
overflow: hidden;
}
Demo
Here's a simplified demo in which the close transition works also. You can add your styling back in and see what breaks it.

Responsive Menu Toggle Doesn't Work

For whatever reason, when I add a radio check into the css, it will appear in the menu but will not show any of the menu items. Any tips on getting it to toggle properly would be a huge help!
Here's the fiddle:
http://jsfiddle.net/casslt07/kjjvp1bx/
**HTML**
<div id="nav">
<nav id="nav" class="clearfix">
<!-- nav menu top level -->
<input type="checkbox" id="menu-toggle">
<label for="button" onclick></label>
<ul class="first-level">
<li>Home
<li><a>Posts</a>
<ul>
<li>Listings</li>
<li>Comics</li>
<li>Observations</li>
<li>Poems</li>
<li>Short Stories</li>
</ul>
</li>
<li>Photos
</li>
<li>Videos</li>
<li>About the Author</li>
</ul>
<?php get_search_form(); ?> </nav>
</div>
**CSS:**
/* Config */
body {font-family:Arial}
ul, li {list-style:none; margin:0; padding:0;}
#menu-toggle {
display:none;
}
#nav label {
display:none;
font-size:20px;
list-style:none;
}
/* Nav */
#nav {
background-color:#33447A;
height: inherit;
border-bottom: 3px solid #13EBC7;
position:relative;
display:block; width: 100%; overflow:visible;}
#nav a {
color:#fff; display:block; font-size: 11pt; padding:18px 20px; text-decoration:none; text-align: left;}
#nav ul li {position:relative;}
/* First-Level */
#nav li {transition:background-color .5s; float:left;}
#nav li:hover {background-color:#50AEED; -webkit-transition: margin-bottom .2s; /* Safari 3.1 to 6.0 */
transition: margin-bottom .2s;}
#nav > ul > li {display:block; float:left; }
/* Second-level */
#nav li ul {width: 100%;}
#nav > ul li:hover > ul {opacity:1; top:54px; visibility:visible; border-radius: 4px; z-index:3; }
#nav .first-level .second-level > li {float:left;}
#nav > ul ul {opacity:0; visibility:hidden; position:absolute; top:60px; transition:all .25s; width:1000px;}
#nav > ul ul li {background-color:#3498db; left:0;}
#nav > ul ul li a {padding:10px 20px}
/* Clearfix */
.clearfix:after {visibility: hidden; display: block; font-size: 0; content:" "; clear:both; height:0;}
.nav-search {
opacity: .25;
width:35%;
float: right;
display:inline;
position: relative;
background: #3498db;
background: url('http://1touchsigns.com/images/search.gif');
background-repeat: no-repeat;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
border:none;
top:7px;
padding:6px;
outline:none;
transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-webkit-transition: all .3s ease-in-out;
}
.nav-search:focus {
background: white;
opacity: 1;
}
#responsive {
display: none;
}
#media only screen and (max-width: 480px) {
#menu-toggle {
display:block;
}
#nav label {display: block;height:50px;width:50px;line-height:50px;text-align:center;color:white;font-size:150%;background-color: #83CE69; cursor:pointer;}
#menu-toggle:checked + #nav {display: block;}
#nav label:active #nav {display: none;}
#nav {
display: block;
width: 100%;
height:auto;
float: right;
margin-right: 10px;
background-color: #232323;
border-bottom-width: 0px;
}
#nav ul {
display:none;
}
#nav ul:hover {
display:block;
}
#nav li {
width:100%;
}
#nav ul ul li {
width:100%;
color:white;
background-color:black;
display:block;
}
#nav ul ul li:hover {
display:block;
}
}
Add
#menu-toggle:checked + label + ul {
display: block;
}
http://jsfiddle.net/kjjvp1bx/3/
Or use jQuery, both works:
http://jsfiddle.net/kjjvp1bx/2/

Centering subnav along with top main nav

I had some help here getting multi-lined text in my main nav to center vertically but I'm having trouble getting the text in the sub nav to do the same. I've made a bit of a mess.
http://codepen.io/Compton/pen/icBDw/
#nav-wrap {
width:100%;
height:100px;
font-weight:500;padding: 0;
left:0;
font-family: 'Raleway', Arial, sans-serif;
}
#nav-wrap ul {
list-style-type: none;
margin: 0;
padding:0;
text-transform: uppercase;
}
#nav-wrap ul li {
width:14.275%; /* ~(100/7) */
display:block;
float:left;
text-align:center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#nav-wrap ul li a {
width:100%;
display: block;
height: 100%;
position: relative;
color:#FFFFFF !important;
text-decoration:none;
}
#nav-wrap ul li + li {
border-left: 1px #fff solid;
}
#nav-wrap ul li span {
display: inline-block;
vertical-align: middle;
height: 100px;
font-size:1.45em;
text-align: center;
padding: 0 5% 0 5%; /* was 0 20px */
line-height: 100px;
}
#nav-wrap ul li.yellow-facebook {
width:14.275%;
}
#nav-wrap ul li.yellow-facebook a {
background-size:130px 26px; /* > 25px */
}
#nav-wrap .doubleLine {
display: table-cell;
line-height: 1.2em;
width:65.275%;
}
li .subnav {
display: none;
position: absolute;
clear: both;
margin-left: 0;
/*font-size:0.9em;*/
}
.subnav ul {
margin-left: 0;
float:left;
padding:0;
width:100%;
}
.subnav ul li {
margin: 0 0 0 0;
height:42px;
}
.subnav ul li a {
padding: 5px 0 5px 0;/*
background-image: url(../images/submenu-background-divider.png);
background-repeat:no-repeat;
background-position:left;*/
}
.subnav ul li span {
display: inline-block !important;
vertical-align: middle !important;
height: 40px !important;
text-align: center !important;
padding: 0 0 0 0 !important; /* was 0 20px */
line-height: 1.1em !important;
font-size:0.9em !important;
}
.subnavul li span .doubleLine {
display: table-cell !important;
width:65.275% !important;
}
.subnav {
width:100%;
padding: 0;
margin: 0.05% 0 0 0;
}
#nav-wrap ul li.orange a {
background-color:#f37028;
}
#nav-wrap ul li.orange a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.red a {
background-color:#ed1b24;
}
#nav-wrap ul li.red a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.pink a {
background-color:#e54198;
}
#nav-wrap ul li.pink a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.purple a {
background-color:#6b439c;
}
#nav-wrap ul li.purple a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.blue a {
background-color:#0193cf;
}
#nav-wrap ul li.blue a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.green a {
background-color:#80c02c;
}
#nav-wrap ul li.green a:hover {
color: #231f20 !important;
}
#nav-wrap ul li.yellow-facebook a {
background-color:#fff300;
background-image:url(../images/social-media/facebook-text.png);
background-repeat:no-repeat;
background-position:center;
}
#nav-wrap ul li.yellow-facebook a:hover {
color: #231f20;
background-image:url(../images/social-media/facebook-text_over.png);
}
.subnav ul li a:link, a:active, a:visited {
text-decoration:none;
}
.subnav ul li a:hover {
color:#000;
text-decoration:none;
}
li:hover > .subnav {display:inline-block; left:0;}
Adding display:table-cell; for the following like below
.subnav ul li span {
display: table-cell !important;
vertical-align: middle !important;
height: 40px !important;
text-align: center !important;
padding: 0 0 0 0 !important; /* was 0 20px */
line-height: 1.1em !important;
font-size:0.9em !important;
}
fixes the issue