Bootstrap breaking mutli-level menu - html

I made this menu before i just started using bootstrap. The menu is generated from the database. The HTML output is shown below.
<ul id="nav">
<li value="1">Home</li>
<li value="2">
Portfolio
<ul class='Subs'>
<li value="5">Web Design</li>
<li value="6">Graphic Design</li>
<li value="7">Logo Design</li>
<li value="8">Blog Design</li>
</ul>
</li>
<li value="3">
Projects
<ul class='Subs'>
<li value="9">Project1</li>
<li value="10">Project2</li>
<li value="11">Project3</li>
<li value="12">Project4</li>
</ul>
</li>
<li value="4">
Contact
<ul class='Subs'>
<li value="13">Support</li>
<li value="14">Quote</li>
<li value="15">General Inquiry</li>
</ul>
</li>
<li value="16">kaas</li>
</ul>
Here is the CSS i use
#nav span {
display: none;
}
#nav, #nav ul {
list-style: none outside none;
margin: 0;
padding: 0;
z-index: 99;
}
#nav {
color-stop(0, #E3E3E3),
color-stop(0.5, white)
background-image: -o-linear-gradient(bottom, #E3E3E3 0%, white 100%);
background-image: -moz-linear-gradient(bottom, #E3E3E3 0%, white 100%);
background-image: -webkit-linear-gradient(bottom, #E3E3E3 0%, white 100%);
background-image: -ms-linear-gradient(bottom, #E3E3E3 0%, white 100%);
background-image: linear-gradient(to bottom, #E3E3E3 0%, white 100%);
border-bottom: 5px solid #333333;
float: left;
margin-left: 1%;
margin-right: 1%;
position: relative;
width: 98%;
}
#nav ul.subs {
color-stop(0, #E3E3E3),
color-stop(0.5, white)
background-color: -o-linear-gradient(bottom, white 0%, #E3E3E3 100%);
background-image: -moz-linear-gradient(bottom, white 0%, #E3E3E3 100%);
background-image: -webkit-linear-gradient(bottom, white 0%, #E3E3E3 100%);
background-image: -ms-linear-gradient(bottom, white 0%, #E3E3E3 100%);
background-image: linear-gradient(to bottom, white 0%, #E3E3E3 100%);
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
color: #333333;
display: none;
left: 0;
padding: 2%;
position: absolute;
top: 54px;
width: 96%;
}
#nav > li {
border-bottom: 5px solid transparent;
float: left;
margin-bottom: -5px;
text-align: left;
-moz-transition: all 300ms ease-in-out 0s;
-ms-transition: all 300ms ease-in-out 0s;
-o-transition: all 300ms ease-in-out 0s;
-webkit-transition: all 300ms ease-in-out 0s;
transition: all 300ms ease-in-out 0s;
}
#nav li{
display: block;
text-decoration: none;
-moz-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
-ms-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
-o-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
-webkit-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
white-space: normal;
}
#nav > li{
color: #333333;
display: block;
font-size: 1.3em;
line-height: 49px;
padding: 0 15px;
text-transform: uppercase;
}
#nav > li:hover, #nav :hover {
background-color: #F55856;
color: #FFFFFF;
cursor: pointer;
}
#nav li.active > li{
background-color: #333333;
color: #FFFFFF;
}
#nav li:hover ul.subs {
display: block;
}
#nav ul.subs > li {
display: inline-block;
float: none;
padding: 10px 1%;
vertical-align: top;
width: 33%;
}
#nav ul.subs > li{
color: #777777;
line-height: 20px;
}
#nav ul.subs > li{
font-size: 1.3em;
margin-bottom: 10px;
text-transform: uppercase;
}
#nav ul.subs > li{
float: none;
padding-left: 8px;
font-size: 0.8em;
margin: 0px;
padding: 5px;
-moz-transition: padding 150ms ease-out 0s;
-ms-transition: padding 150ms ease-out 0s;
-o-transition: padding 150ms ease-out 0s;
-webkit-transition: padding 150ms ease-out 0s;
transition: padding 150ms ease-out 0s;
}
#nav ul.subs > li li:hover {
padding-left: 15px;
}
#nav ul.subs > li:hover{
color: red;
cursor: pointer;
}
Without bootstrap it looks fabulous, so could anybody explain to me how this is happening and this can be fixed?
Thanks in advance

You put an uppercase letter at the beginning of the class Subs when it should actually be subs, which, if you check your CSS is a correct match.
DEMO JSFiddle

Related

Mob Nav Menu Shows & Hides on Media Query Shrink

If you look at code, when shrinking page, the menu quickly shows up and then slides back down. I'd like it to not show up at all when page shrinks. I can't understand why this is happening.
I assume it may be smth with transitions on #nav instead of input[type="checkbox"]:checked + #nav, but i need to have animation on #nav. I had separate file I played with just for mobile nav and it worked fine. As soon as I started working with media queries things go south.
here's fiddle:
https://jsfiddle.net/reizer/fwzsxrnt/
* {margin:0;padding:0;border:0;list-style:none;font-size:100%;font:inherit;vertical-align:baseline;}
/*RESET*/
body {font: 1em Arial, Helvetica, sans-serif;}
#wrapper {
max-width: 960px;
margin: auto;
}
#nav {
display: block;
max-height: 0em;
overflow: hidden;
transition: max-height 0.5s ease;
-webkit-transition: max-height 0.5s ease;
-moz-transition: max-height 0.5s ease;
-o-transition: max-height 0.5s ease;
}
input[type="checkbox"] {
position: absolute;
margin-top: -100em;
}
input[type="checkbox"]:checked + #nav{
max-height: 20em;
}
label {
background: #9c0;
cursor: pointer;
display: block;
overflow: auto;
padding-left: 1em;
background-color: #9C0;
background: -moz-linear-gradient(top, #99cc00 0%, #85b100 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#99cc00), color-stop(100%,#85b100));
background: -webkit-linear-gradient(top, #99cc00 0%,#85b100 100%);
background: -o-linear-gradient(top, #99cc00 0%,#85b100 100%);
background: -ms-linear-gradient(top, #99cc00 0%,#85b100 100%);
background: linear-gradient(to bottom, #99cc00 0%,#85b100 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#99cc00', endColorstr='#85b100',GradientType=0 );
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: #FFF;
font-size: 1.6em;
line-height: 2.6em;
}
label:after {
content: "\f039";
float: right;
background-color: #669900;
padding: 0.2em 0.3em 0.1em;
margin: 0.5em;
font: 1.2em FontAwesome;
border-radius: 0.3em;
-webkit-box-shadow: inset 0em 0.1em 0.2em 0em rgba(0,0,0,0.3);
-moz-box-shadow: inset 0em 0.1em 0.2em 0em rgba(0,0,0,0.3);
box-shadow: inset 0em 0.1em 0.2em 0em rgba(0,0,0,0.3);
}
#nav ul li a {
background: #690;
border: solid #90c12f;
border-width: 1px 0 0;
text-decoration: none;
padding: 1em;
display: block;
color: #FFF;
}
#nav ul li a:hover, #nav ul li a:active {
background: #abd728;
}
#media screen and (min-width: 479px) {
.d----onttouchshituntilthispoin----t {
}
label {
display:none;
}
#nav {
display: table;
width: 100%;
max-height: 20em;
overflow: auto;
}
#nav ul {
display: table-row;
}
#nav ul li {
display: table-cell;
}
#nav ul li a {
color: #000;
position: relative;
text-align: center;
text-indent: 20px;
border: solid #000;
border-width: 0 1px 0 0;
line-height: 3.4em;
padding: 0px 20px 0px 0px;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
} #nav ul li:last-child a{border:none}
#nav ul li a:hover {
position: relative;
text-indent: 0px;
padding-right: 40px;
}
#nav ul li a:before {
font-family: FontAwesome;
content: "\f078";
position: absolute;
right: 1em;
margin-top: -0.85em;
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
}
#nav ul li a:hover:before {
margin-top: 0em;
visibility: visible;
opacity: 1;
}
#nav ul li a ul li {
position: absolute;
background: #FF0;
display: block;
width: 100%;
height: 0em;
visibility: hidden;
opacity: 0;
border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
-webkit-border-radius: 0px 0px 5px 5px;
-webkit-transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
-o-transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
-moz-transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
}
#nav ul li a:hover ul li {
visibility: visible;
opacity: 1;
height: 1em;
-webkit-transition:height 0.5s ease;
transition:height 0.5s ease;
-o-transition:height 0.5s ease;
-moz-transition:height 0.5s ease;
}
<div id="wrapper"><div id="logo"></div><label for="toggle">menu</label>
<input type="checkbox" id="toggle">
<div id="nav">
<ul>
<li>Home<ul><li></li></ul></li>
<li>About<ul><li></li></ul></li>
<li>Products<ul><li></li></ul></li>
<li>FAQ<ul><li></li></ul></li>
<li>Support<ul><li></li></ul></li>
<li>Contact<ul><li></li></ul></li>
</ul>
</div>
test
</div>
Just remove max-height: 20em; from #nav in the media query.
JSFiddle Here
* {
margin: 0;
padding: 0;
border: 0;
list-style: none;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/*RESET*/
body {
font: 1em Arial, Helvetica, sans-serif;
}
#wrapper {
max-width: 960px;
margin: auto;
}
#nav {
display: block;
max-height: 0em;
overflow: hidden;
transition: max-height 0.5s ease;
-webkit-transition: max-height 0.5s ease;
-moz-transition: max-height 0.5s ease;
-o-transition: max-height 0.5s ease;
}
input[type="checkbox"] {
position: absolute;
margin-top: -100em;
}
input[type="checkbox"]:checked + #nav {
max-height: 20em;
}
label {
background: #9c0;
cursor: pointer;
display: block;
overflow: auto;
padding-left: 1em;
background-color: #9C0;
background: -moz-linear-gradient(top, #99cc00 0%, #85b100 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #99cc00), color-stop(100%, #85b100));
background: -webkit-linear-gradient(top, #99cc00 0%, #85b100 100%);
background: -o-linear-gradient(top, #99cc00 0%, #85b100 100%);
background: -ms-linear-gradient(top, #99cc00 0%, #85b100 100%);
background: linear-gradient(to bottom, #99cc00 0%, #85b100 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#99cc00', endColorstr='#85b100', GradientType=0);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: #FFF;
font-size: 1.6em;
line-height: 2.6em;
}
label:after {
content: "\f039";
float: right;
background-color: #669900;
padding: 0.2em 0.3em 0.1em;
margin: 0.5em;
font: 1.2em FontAwesome;
border-radius: 0.3em;
-webkit-box-shadow: inset 0em 0.1em 0.2em 0em rgba(0, 0, 0, 0.3);
-moz-box-shadow: inset 0em 0.1em 0.2em 0em rgba(0, 0, 0, 0.3);
box-shadow: inset 0em 0.1em 0.2em 0em rgba(0, 0, 0, 0.3);
}
#nav ul li a {
background: #690;
border: solid #90c12f;
border-width: 1px 0 0;
text-decoration: none;
padding: 1em;
display: block;
color: #FFF;
}
#nav ul li a:hover,
#nav ul li a:active {
background: #abd728;
}
#media screen and (min-width: 479px) {
.d----onttouchshituntilthispoin----t {} label {
display: none;
}
#nav {
display: table;
width: 100%;
overflow: auto;
}
#nav ul {
display: table-row;
}
#nav ul li {
display: table-cell;
}
#nav ul li a {
color: #000;
position: relative;
text-align: center;
text-indent: 20px;
border: solid #000;
border-width: 0 1px 0 0;
line-height: 3.4em;
padding: 0px 20px 0px 0px;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
}
#nav ul li:last-child a {
border: none
}
#nav ul li a:hover {
position: relative;
text-indent: 0px;
padding-right: 40px;
}
#nav ul li a:before {
font-family: FontAwesome;
content: "\f078";
position: absolute;
right: 1em;
margin-top: -0.85em;
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
}
#nav ul li a:hover:before {
margin-top: 0em;
visibility: visible;
opacity: 1;
}
#nav ul li a ul li {
position: absolute;
background: #FF0;
display: block;
width: 100%;
height: 0em;
visibility: hidden;
opacity: 0;
border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
-webkit-border-radius: 0px 0px 5px 5px;
-webkit-transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
-o-transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
-moz-transition: height 0.5s ease, opacity 0.0s ease 0.5s, visibility 0.0s ease 0.5s;
}
#nav ul li a:hover ul li {
visibility: visible;
opacity: 1;
height: 1em;
-webkit-transition: height 0.5s ease;
transition: height 0.5s ease;
-o-transition: height 0.5s ease;
-moz-transition: height 0.5s ease;
}
<div id="wrapper">
<div id="logo"></div>
<label for="toggle">menu</label>
<input type="checkbox" id="toggle">
<div id="nav">
<ul>
<li>Home<ul><li></li></ul>
</li>
<li>About<ul><li></li></ul>
</li>
<li>Products<ul><li></li></ul>
</li>
<li>FAQ<ul><li></li></ul>
</li>
<li>Support<ul><li></li></ul>
</li>
<li>Contact<ul><li></li></ul>
</li>
</ul>
</div>
test
</div>

how to create fly out for ul li

I have an ul li structure that give me one fly out that is it gives me sub-menu but i want one more sub-menu on hover first sub-menu.
following is the structure
My Css
.main-navi li{
position: relative;
}
.main-navi li div,
.main-navi a{
display: block;
line-height: 80px;
text-transform: uppercase;
font-weight: 900;
padding-left: 30px;
color: #999;
border-bottom: 1px solid #FFFFFF;
position: relative;
z-index: 1;
background: #3a5795;
cursor: pointer;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
.main-navi li div{
padding-left: 0;
border: none;
}
.main-navi li div{
position: relative;
z-index: 1;
background: #1A1A1A;
padding-left: 30px;
border-bottom: 1px solid #212121;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
.main-navi a.active:hover,
.main-navi a.active{
padding-left: 50px;
color: #fff;
background: #ff3333;
cursor: default;
}
.main-navi .dot{
width: 10px;
height: 10px;
position: absolute;
top: 50%;
margin-top: -5px;
right: 30px;
background: #333;
border-radius: 50%;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
.main-navi li div .corner,
.main-navi a .corner{
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
opacity: 0;
z-index: -1;
border-top: 40px solid transparent;
border-left: 20px solid #1A1A1A;
border-bottom: 40px solid transparent;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
.main-navi li div.active .corner,
.main-navi a.active .corner{
right: -20px;
opacity: 1;
border-left: 20px solid #ff3333;
}
.main-navi a.active:hover .dot,
.main-navi a.active .dot{
background: #fff;
}
.main-navi li div:hover,
.main-navi a:hover{
padding-left: 50px;
color: #fff;
background: #151515;
}
.main-navi li div.active{
padding-left: 50px;
background: #ff3333;
color: #fff;
}
.main-navi li div:hover .dot,
.main-navi a:hover .dot{
background: #ff3333;
}
.main-navi li div.active .dot{
background: #fff;
}
.drop-down {
left: 0;
overflow-y: scroll;
position: absolute;
top: -0;
width: 250px;
height:480px;
z-index: -2;
background: #151515;
opacity: 0;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
::-webkit-scrollbar
{
width: 5px;
}
::-webkit-scrollbar-track
{
background-color: #ff3333;
}
::-webkit-scrollbar-thumb
{
background-color: #ffffff;
}
::-webkit-scrollbar-button
{
background-color: #000000;
}
::-webkit-scrollbar-corner
{
background-color: black;
}
.main-navi li:hover .drop-down{
left: 100%;
opacity: 1;
}
.active .drop-down{
overflow: visible;
}
.main-navi .drop-down a{
background: #3a5795;
border-bottom: 1px solid #ffffff;
line-height: 40px;
}
.main-navi .drop-down a:hover{
padding-left: 40px;
}
<!-- code i created to get sub of sub menu-->
.drop-down-in {
left: 100;
overflow-y: scroll;
position: absolute;
top: -0;
width: 250px;
height:480px;
z-index: -2;
background: #151515;
opacity: 1;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
.main-navi .drop-down li:hover .drop-down-in{
left: 200%;
opacity: 1;
}
.active .drop-down-in{
overflow: visible;
}
.main-navi .drop-down .drop-down-in a{
background: #3a5795;
border-bottom: 1px solid #ffffff;
line-height: 40px;
}
.main-navi .drop-down .drop-down-in a:hover{
padding-left: 40px;
}
<!--ends here-->
this is css that contains code for both sub and sub inside sub-menu. class drop-down works fine i want one more sub-menu so i created class drop-down-in which is not working.
My html code is:
<ul>
<li>Home<span class="dot"></span><span class="corner"></span></li>
<li> About<span class="dot"></span><span class="corner"></span></li>
<li>Products And Services<span class="dot"></span><span class="corner"></span>
<ul class="drop-down">
<li>Calenders
<ul class="drop-down-in">
<li>Calenders</li>
<li>Clock Printing</li>
<li>key</li>
<li>Menu Cards</li>
</ul>
</li>
<li>Clock Printing</li>
</ul>
Here is a Fiddle to my question.
You forgot to add the class attribute with the value "main-navi" to your first "ul" element.
<ul class="main-navi">
<li>Home<span class="dot"></span><span class="corner"></span></li>
<li> About<span class="dot"></span><span class="corner"></span></li>
<li>
Products And Services<span class="dot"></span><span class="corner"></span>
<ul class="drop-down">
<li>
Calenders
<ul class="drop-down-in">
<li>Calenders</li>
<li>Clock Printing</li>
<li>key</li>
<li>Menu Cards</li>
</ul>
</li>
<li>Clock Printing</li>
</ul>
</li>
And in CSS you schould update:
.main-navi li:hover .drop-down{
left: 100%;
}
If the value for "left" is 100%, than this element wont be visible.
Here you can find an updated Fiddle.

Nav with div inside (two different menus)

I made an image of what I would like to do, sort of, but I cant seem to work it out.
What I would like:
I currently have the nav but it is all in a div, what I want to do, is to divide it, have two different divs and each with different content.
Here's my actual code.
UPDATED:
CSS
#nav
{
position:fixed;
top: 0;
left: 0;
width: 100%;
height:7%;
text-align: center;
padding: .5em 0 1em 0;
z-index: 1;
overflow: hidden;
background-image: -webkit-gradient(
linear,
right top,
left bottom,
color-stop(0, #E1A141),
color-stop(0.43, #DF7266)
);
background-image: -o-linear-gradient(left bottom, #E1A141 0%, #DF7266 43%);
background-image: -moz-linear-gradient(left bottom, #E1A141 0%, #DF7266 43%);
background-image: -webkit-linear-gradient(left bottom, #E1A141 0%, #DF7266 43%);
background-image: -ms-linear-gradient(left bottom, #E1A141 0%, #DF7266 43%);
background-image: linear-gradient(to left bottom, #E1A141 0%, #DF7266 43%);
}
div#a
{
float: left !important;
width: 50%;
display:inline !important;
}
div#b
{
float: left !important;
width: 50%;
}
#nav > ul
{
width:40%;
line-height: 0px;
display: inline-block;
}
#nav > ul:before,
#nav > ul:after
{
content: 'sentido';
width: 300%;
position: absolute;
top: 50%;
margin-top: -2px;
height: 5px;
border-top: solid 1px rgba(192,192,192,0.35);
border-bottom: solid 1px rgba(192,192,192,0.35);
}
#nav > ul:before
{
left: 100%;
margin-left: 1px;
}
#nav > ul:after
{
right: 100%;
margin-right: 1px;
}
#nav > ul > li
{
display: inline-block;
margin: -9px 0.5em 0 0.5em;
border-radius: 0.5em;
padding: 0.85em;
border: solid 1px transparent;
-moz-transition: color 0.35s ease-in-out, border-color 0.35s ease-in-out;
-webkit-transition: color 0.35s ease-in-out, border-color 0.35s ease-in-out;
-o-transition: color 0.35s ease-in-out, border-color 0.35s ease-in-out;
-ms-transition: color 0.35s ease-in-out, border-color 0.35s ease-in-out;
transition: color 0.35s ease-in-out, border-color 0.35s ease-in-out;
}
#nav > ul > li.active
{
border-color: rgba(192,192,192,0.35);
}
#nav > ul > li > a,
#nav > ul > li > span
{
display: block;
color: inherit;
text-decoration: none;
border: 0;
outline: 0;
}
#nav > ul > li > ul
{
display: none;
}
html
<nav id="nav" style="z-index: 9999;" id="navigation">
<div id="a">
<ul>
<li>Inicio</li>
<li>Encuentra</li>
<li>Aventura al Azar</li>
<li>Contacto</li>
</ul>
</div>
<div id="b"> holibebe </div>
</nav>
Any help will be greatly appreciated.
Thanks,
Enrique Bravo.
Set your divs(1 and 2) to be 50% of their parent, in this case the nav element then float the divs and clear them.
BASIC example, going off of your image:
JsFiddle Example

CSS3 animation transition: opacity not working

i'm having some trouble with animating a dropdown menu using css3. I need it to work with css3 and not jQuery or javascript. I've added all the rules neccessary but still the effect doesn't happen. Can anyone please help? Here is a fiddle of my code. Thank you.
http://jsfiddle.net/Zmr7u/6/
html code:
<header class="main-header">
<nav class="main-nav">
<ul class="top-nav">
<li>
home
<ul class="drop-down">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>
about
<ul class="drop-down">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>
products
<ul class="drop-down">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>
contacts
<ul class="drop-down">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
</ul>
</nav>
</header>
css code:
nav.main-nav {
background: #333;
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#2f2f2f), to(#4f4f4f));
background-image: -webkit-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: -moz-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: -ms-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: -o-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: linear-gradient(top, #2f2f2f, #4f4f4f);
width: 100%;
}
.top-nav {
border-bottom: 2px solid #111;
height: 30px;
list-style-type: none;
margin: 0;
padding-left: 0;
width: 100%;
}
.top-nav li {
background: #333;
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#2f2f2f), to(#4f4f4f));
background-image: -webkit-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: -moz-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: -ms-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: -o-linear-gradient(top, #2f2f2f, #4f4f4f);
background-image: linear-gradient(top, #2f2f2f, #4f4f4f);
border-bottom: 2px solid #111;
border-right: 1px solid #555;
float: left;
font-size: 14px;
height: 20px;
padding-top: 10px;
position: relative;
text-align: center;
width: 150px;
}
.top-nav li ul.drop-down {
position: absolute;
top: 32px;
left: 0;
visibility: hidden;
display: none;
opacity: 0;
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
-o-transition: opacity 0.3s;
transition: opacity 0.3s;
}
.top-nav li:hover ul.drop-down {
visibility: visible;
opacity: 1;
display: block;
}
.top-nav li .drop-down li {
height: 20px;
-webkit-transition: height 0.3s ease;
-moz-transition: height 0.3s ease;
-o-transition: height 0.3s ease;
transition: height 0.3s ease;
}
.top-nav li .drop-down li:hover {
height: 30px;
}
.top-nav li a {
color: #aaa;
padding-top: 5px;
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 25px;
text-decoration: none;
}
You can just use visibility without using display:
.top-nav li ul.drop-down {
list-style-type: none;
position: absolute;
top: 32px;
left: -40px;
visibility: hidden;
opacity: 0;
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
-o-transition: opacity 0.3s;
transition: opacity 0.3s;
}
.top-nav li:hover ul.drop-down {
visibility: visible;
opacity: 1;
}
Demo.
You can use css animation when you want to increase opacity and make the element visible, like --
span {
display: none;
opacity: 0;
}
To make span visible
span {
display: block;
animation: visible 2s;
}
#keyframes visible {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
And if you're getting a bug when make animation less than 1s then use animation: visible 0.5s forwards;

HTML5 - stop wrapping

I've tried suggestions from other answers like, white-space: wrapnow;, nothing's worked so far. My question is, how do I stop the wrapping of text in HTML?
The text on the navbar moves out of position as I minimize my browser, how do I stop this om happening?
Here's a pic of the problem...
My CSS
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
white-space: nowrap;
}
.menu {
margin-top: -8px;
height: 50px;
width: 100%;
position: absolute; right: 0; left: 0;
text-align: left;
background: rgb(63,76,107); /* Old browsers */
background: -moz-linear-gradient(top, rgba(63,76,107,1) 0%, rgba(63,76,107,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(63,76,107,1)), color-stop(100%,rgba(63,76,107,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3f4c6b', endColorstr='#3f4c6b',GradientType=0 ); /* IE6-9 */
box-shadow: 0px 1px 3px #000000;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
}
.menu li {
position: relative;
list-style: none;
float: left;
display: block;
height: 40px;
}
.menu li a { /* Navigation Bar text */
display: block;
padding: 0 20px;
margin: 15px 0;
line-height: 15px;
text-decoration: none;
font-family: sans-serif;
font-weight: bold;
font-size: 12px;
color: #FFFFFF;
/* text-shadow: 1px 1px 1px rgba(255,255,255,0.3); */
-webkit-transition: color .4s ease-in-out;
-moz-transition: color .4s ease-in-out;
-o-transition: color .4s ease-in-out;
-ms-transition: color .4s ease-in-out;
transition: color .4s ease-in-out;
}
.menu li:first-child a{ border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { text-decoration: underline; }
.menu li#navbar-logo:hover > a { text-decoration: none; }
.menu ul {
position: absolute;
top: 35px;
left: 0;
opacity: 0;
background: rgba(63,76,107,1);
border-left: 1px solid #393942;
border-bottom: 1px solid #393942;
border-right: 1px solid #393942;
-webkit-border-radius: 0 0 2px 2px;
-moz-border-radius: 0 0 2px 2px;
border-radius: 0 0 2px 2px;
-webkit-transition: opacity .75s ease .1s;
-moz-transition: opacity .75s ease .1s;
-o-transition: opacity .75s ease .1s;
-ms-transition: opacity .75s ease .1s;
transition: opacity .75s ease .1s;
}
.menu li:hover > ul {
opacity: 1;
}
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
.menu li:hover > ul li {
height: 35px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 100px;
padding: 10px 0 10px 10px;
margin: 0;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a {
border: none;
}
.menu li#navbar-logo,
.menu li#navbar-about,
.menu li#navbar-shop,
.menu li#navbar-contact,
.menu li#navbar-community {
margin-top: 5px;
}
.menu li#navbar-logo {
margin-top: 3px;
}
.menu li#navbar-logo,
.menu li#navbar-about,
.menu li#navbar-shop,
.menu li#navbar-contact,
.menu li#navbar-community {
margin-left: -13px;
margin-right: 5px;
}
.menu li#navbar-about,
.menu li#navbar-shop,
.menu li#navbar-contact,
.menu li#navbar-community {
margin-left: 5px;
margin-right: 5px;
}
#navbar-logo a{
color: #FFC8C8;
text-shadow: 2px 2px 2px rgba(255, 0, 0, 1);
font-size: 50px;
font-family: Intrique Script Personal Use;
}
The HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Title of Webpage</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<header>
<nav class="navbar">
<ul class="menu">
<li id="navbar-logo">Arc Studios</li>
<li id="navbar-about">About Us
<ul>
<li>FAQ's</li>
<li>Our Inception</li>
<li>Locations</li>
</ul>
</li>
<li id="navbar-shop">Store
<ul>
<li>Games</li>
<li>OS's</li>
<li>Other</li>
</ul>
</li>
<li id="navbar-contact">Contact
<ul>
<li>Email</li>
<li>Help Centre</li>
</ul>
</li>
<li id="navbar-community">Community
<ul>
<li>Forums</li>
<li>Events</li>
</ul>
</li>
</ul>
</nav>
</header>
<br></br>
<footer class="footer">
<p><small>© Copyright Arc Innovations 2013, All rights reserved</small></p>
</footer>
</body>
</html>
Maybe try something like this?
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
white-space: nowrap;
overflow: hidden;
}
It would be easier to debug with a http://www.jsfiddle.net example.
I believe white-space: nowrap; should work.