How do I make the box smaller in html? - html

In my code, I have a drop-down menu. However, the grey box extends to the end of the screen. How can I limit the grey box?
Code from here: http://cssdeck.com/labs/7rsznauv
HTML:
<nav>
<ul class="cf">
<li><a class="dropdown" href="#">Menu Item 2</a>
<ul>
<li>Sub-menu Item 1</li>
<li>Sub-menu Item 2</li>
<li>Sub-menu Item 3</li>
</ul>
</li>
</ul>
</nav>
CSS:
nav ul {
-webkit-font-smoothing:antialiased;
text-shadow:0 1px 0 #FFF;
background: #ddd;
list-style: none;
margin: 0;
padding: 0;
width: 100%;
}
nav li {
float: left;
margin: 0;
padding: 0;
position: relative;
min-width: 25%;
}
nav a {
background: #ddd;
color: #444;
display: block;
font: bold 16px/50px sans-serif;
padding: 0 25px;
text-align: center;
text-decoration: none;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
nav .dropdown:after {
content: ' ▶';
}
nav .dropdown:hover:after{
content:'\25bc'
}
nav li:hover a {
background: #ccc;
}
nav li ul {
float: left;
left: 0;
opacity: 0;
position: absolute;
top: 35px;
visibility: hidden;
z-index: 1;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
nav li:hover ul {
opacity: 1;
top: 50px;
visibility: visible;
}
nav li ul li {
float: none;
width: 100%;
}
nav li ul a:hover {
background: #bbb;
}
/* Clearfix */
.cf:after, .cf:before {
content:"";
display:table;
}
.cf:after {
clear:both;
}
.cf {
zoom:1;
}​

nav ul {
-webkit-font-smoothing:antialiased;
text-shadow:0 1px 0 #FFF;
background: #ddd;
list-style: none;
margin: 0;
padding: 0;
width: 90%; // I made it 90% you can make it even narrower
}
Just reduce the width by reducing the percentage or like width: 180px;

just change the width in hnav ul{....}, actually is 100%, change it to 50% or whatever you want

Related

Changing Current Tab Drop Down Menu Color

I have a question regarding the text color of my drop down menu. The drop down text color is based off of the main link text color. When I select that link it changes to the current tab color, but also changes the drop down text color. I was wondering how to make the drop down menu color independent from the main tab text color.
Here is the HTML:
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="Show navigation">Show navigation</a>
<a class="mobile-btn" href="#" title="Hide navigation">Hide navigation</a>
<ul id="nav" class="nav">
<li>Home</li>
<li class="current">Blog
</li>
<li><span>Resources</span>
<ul>
<li>Alcohol</li>
<li>Drugs</li>
<li>Mental Health</li>
<li>Suicide</li>
</ul>
</li>
<li>About</li>
<li>Contact</li>
</ul> <!-- end #nav -->
</nav> <!-- end #nav-wrap -->
And here is the CSS:
#nav-wrap ul, #nav-wrap li, #nav-wrap a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
/* nav-wrap */
#nav-wrap {
position: relative;
font: 15px raleway-heavy, sans-serif;
text-transform: uppercase;
letter-spacing: 1.5px;
float: right;
margin-top: 32px;
margin-right: 20px;
z-index: 99999;
}
/* hide toggle button */
#nav-wrap > a.mobile-btn {
display: none;
border-radius: 3px;
}
ul#nav {
min-height: 48px;
width: auto;
/* left align the menu */
text-align: left;
}
ul#nav li {
position: relative;
list-style: none;
height: 48px;
display: inline-block;
}
/* Links */
ul#nav li a {
/* 8px padding top + 8px padding bottom + 32px line-height = 48px */
display: inline-block;
padding: 8px 11px;
line-height: 32px;
text-decoration: none;
text-align: left;
color: #ffffff;
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
ul#nav li a:active { background-color: transparent !important; }
ul#nav li:hover > a,
ul#nav li.current a { color: #00b2ee; }
/* adds down arrow */
ul#nav span:after {
width: 0;
height: 0px;
border: 4px solid transparent;
border-bottom: none;
border-top-color: #00b2ee;
content: '';
vertical-align: middle;
display: inline-block;
position: relative;
right: 5px;
}
/* Sub Menu
----------------------------------------------------- */
ul#nav ul {
position: absolute;
top: 100%;
left: 0;
background: #c7c7c7;
min-width: 100%;
border-radius: 5px 5px 7px 7px;
/* for transition effects */
opacity: 0;
filter: alpha(opacity=0);
-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;
}
/* Third level sub menu
ul#nav ul ul {
position: absolute;
top: 0;
left: 100%;
border-radius: 0 3px 3px 3px;
}
*/
ul#nav ul li {
padding: 0;
display: block;
text-align: left;
/* for transition effects */
height: 0;
overflow: hidden;
-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;
}
/*On Hover */
ul#nav li:hover > ul {
opacity: 1; filter: alpha(opacity=100);
}
ul#nav li:hover > ul li {
height: 42px;
overflow: visible;
border-bottom: 1px solid #26272C;
color: #ffffff;
}
ul#nav li:hover > ul li:last-child { border: none; }
/* Sub Menu Anchor links */
ul#nav ul li a {
padding: 6px 15px;
margin: 0;
white-space: nowrap;
font-size: 13px;
}
Any help would be awesome!
add the following at the end of your css script
ul#nav ul li a:hover{
color:red;
}
Example:
#nav-wrap ul, #nav-wrap li, #nav-wrap a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
/* nav-wrap */
#nav-wrap {
position: relative;
font: 15px raleway-heavy, sans-serif;
text-transform: uppercase;
letter-spacing: 1.5px;
float: right;
margin-top: 32px;
margin-right: 20px;
z-index: 99999;
}
/* hide toggle button */
#nav-wrap > a.mobile-btn {
display: none;
border-radius: 3px;
}
ul#nav {
min-height: 48px;
width: auto;
/* left align the menu */
text-align: left;
}
ul#nav li {
position: relative;
list-style: none;
height: 48px;
display: inline-block;
}
/* Links */
ul#nav li a {
/* 8px padding top + 8px padding bottom + 32px line-height = 48px */
display: inline-block;
padding: 8px 11px;
line-height: 32px;
text-decoration: none;
text-align: left;
color: #ffffff;
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
ul#nav li a:active { background-color: transparent !important; }
ul#nav li:hover > a,
ul#nav li.current a { color: #00b2ee; }
/* adds down arrow */
ul#nav span:after {
width: 0;
height: 0px;
border: 4px solid transparent;
border-bottom: none;
border-top-color: #00b2ee;
content: '';
vertical-align: middle;
display: inline-block;
position: relative;
right: 5px;
}
/* Sub Menu
----------------------------------------------------- */
ul#nav ul {
position: absolute;
top: 100%;
left: 0;
background: #c7c7c7;
min-width: 100%;
border-radius: 5px 5px 7px 7px;
/* for transition effects */
opacity: 0;
filter: alpha(opacity=0);
-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;
}
/* Third level sub menu
ul#nav ul ul {
position: absolute;
top: 0;
left: 100%;
border-radius: 0 3px 3px 3px;
}
*/
ul#nav ul li {
padding: 0;
display: block;
text-align: left;
/* for transition effects */
height: 0;
overflow: hidden;
-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;
}
/*On Hover */
ul#nav li:hover > ul {
opacity: 1; filter: alpha(opacity=100);
}
ul#nav li:hover > ul li {
height: 42px;
overflow: visible;
border-bottom: 1px solid #26272C;
color: #ffffff;
}
ul#nav li:hover > ul li:last-child { border: none; }
/* Sub Menu Anchor links */
ul#nav ul li a {
padding: 6px 15px;
margin: 0;
white-space: nowrap;
font-size: 13px;
}
ul#nav ul li a:hover{
color:red;
}
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="Show navigation">Show navigation</a>
<a class="mobile-btn" href="#" title="Hide navigation">Hide navigation</a>
<ul id="nav" class="nav">
<li>Home</li>
<li class="current">Blog
</li>
<li><span>Resources</span>
<ul>
<li>Alcohol</li>
<li>Drugs</li>
<li>Mental Health</li>
<li>Suicide</li>
</ul>
</li>
<li>About</li>
<li>Contact</li>
</ul> <!-- end #nav -->
</nav> <!-- end #nav-wrap -->
I created the fiddle using your code. While hovering over the drop down menu links, the text color changes to the blue as being used on the current menu tab. In case you don't want to use blue on text hover in the drop down menu and want to go with the white text links, just remove "ul#nav li:hover > a," from your code and it'll do the work.
Now your new CSS code should look like :-
#nav-wrap ul, #nav-wrap li, #nav-wrap a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
/* nav-wrap */
#nav-wrap {
position: relative;
font: 15px raleway-heavy, sans-serif;
text-transform: uppercase;
letter-spacing: 1.5px;
float: right;
margin-top: 32px;
margin-right: 20px;
z-index: 99999;
}
/* hide toggle button */
#nav-wrap > a.mobile-btn {
display: none;
border-radius: 3px;
}
ul#nav {
min-height: 48px;
width: auto;
/* left align the menu */
text-align: left;
}
ul#nav li {
position: relative;
list-style: none;
height: 48px;
display: inline-block;
}
/* Links */
ul#nav li a {
/* 8px padding top + 8px padding bottom + 32px line-height = 48px */
display: inline-block;
padding: 8px 11px;
line-height: 32px;
text-decoration: none;
text-align: left;
color: #ffffff;
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
ul#nav li a:active { background-color: transparent !important; }
ul#nav li.current a { color: #00b2ee; }
/* adds down arrow */
ul#nav span:after {
width: 0;
height: 0px;
border: 4px solid transparent;
border-bottom: none;
border-top-color: #00b2ee;
content: '';
vertical-align: middle;
display: inline-block;
position: relative;
right: 5px;
}
/* Sub Menu
----------------------------------------------------- */
ul#nav ul {
position: absolute;
top: 100%;
left: 0;
background: #c7c7c7;
min-width: 100%;
border-radius: 5px 5px 7px 7px;
/* for transition effects */
opacity: 0;
filter: alpha(opacity=0);
-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;
}
/* Third level sub menu
ul#nav ul ul {
position: absolute;
top: 0;
left: 100%;
border-radius: 0 3px 3px 3px;
}
*/
ul#nav ul li {
padding: 0;
display: block;
text-align: left;
/* for transition effects */
height: 0;
overflow: hidden;
-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;
}
/*On Hover */
ul#nav li:hover > ul {
opacity: 1; filter: alpha(opacity=100);
}
ul#nav li:hover > ul li {
height: 42px;
overflow: visible;
border-bottom: 1px solid #26272C;
color: #ffffff;
}
ul#nav li:hover > ul li:last-child { border: none; }
/* Sub Menu Anchor links */
ul#nav ul li a {
padding: 6px 15px;
margin: 0;
white-space: nowrap;
font-size: 13px;
}
In case you want to use some different color while hovering over the drop down text links, you need to use this code separately in the css :-
ul#nav li:hover > a {color:your color name or color code}

Hover in css covering menu above it

I have a menu with a drop down that works nicely but the issue I noticed is if you hover a link with a child element, it opens the menu, but the link then become unclickable on the menu on the bottom half.
<div class="desktop_navigation">
<ul>
<li>Link 1</li>
<li>Link 2
<ul>
<li>Link 2 child</li>
</ul>
</li>
<li>Link 3</li>
</ul>
</div>
That's the structure for the menu. The child elements are sub <ul> of the main <li> and then hidden using CSS until their parent <li> is hovered.
The following jFiddle will include all the CSS I am using and a working example of the issue I am currently having:
https://jsfiddle.net/nrzfa49s/
Your .desktop_navigation ul li ul is inheriting the padding-top: 30px from its parent ul (.desktop_navigation ul) which is covering the parent link (Link 2) making it unclickable.
To fix your problem, update these styles:
.desktop_navigation ul li ul {
list-style: none;
display: none;
padding-top: 0; /*remove the 30px padding*/
}
.desktop_navigation ul li:hover ul {
display: block;
position: absolute;
top: 100%; /*set your top value to be more dynamic based on the height of the parent*/
z-index: 890;
}
Here is a fiddle demoing this solution.
Normally when you style menus like this it is recommended to use the > when styling menu elements because of the nesting (i.e. .desktop_navigation > ul this will prevent the child ul from inheriting the padding)
Took some time, but the issue is here:
.desktop_navigation ul {
list-style: none;
padding: 0;
margin: 0;
padding-top: 30px; //remove this line
}
You only want the padding-top for the ul's to be on the parent/top-level menu. Then if you remove the top attribute from the nested menus, they will display after the link in the top-level menu.
.desktop_navigation a {
color: #ccc;
text-decoration: none;
display: inline-block;
padding: 12px;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
.desktop_navigation ul li:hover a {
color: #fff;
background: #444;
text-decoration: none;
display: inline-block;
z-index: 1002;
padding: 12px;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
.desktop_navigation ul li ul li a:link,
.desktop_navigation ul li ul li a:visited,
.desktop_navigation ul li ul li a:active {
z-index: 1001;
width: 100%;
display: block;
color: #444;
background: #fff;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
.desktop_navigation ul li ul li a:hover {
width: 100%;
display: block;
color: #111;
z-index: 1002;
background: #ccc;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
.desktop_navigation ul {
list-style: none;
padding: 0;
margin: 0;
}
.desktop_navigation > ul {
padding-top: 30px;
}
.desktop_navigation ul li {
display: inline-block;
position: relative;
padding: 0;
margin: 0;
z-index: 1002;
}
.desktop_navigation ul li ul {
list-style: none;
display: none;
}
.desktop_navigation ul li:hover ul {
display: block;
position: absolute;
z-index: 890;
}
.desktop_navigation ul li ul li {
float: none;
position: relative;
min-width: 180px;
z-index: 890;
}
<div class="desktop_navigation">
<ul>
<li>Link 1</li>
<li>
Link 2
<ul>
<li>Link 2 child</li>
</ul>
</li>
<li>Link 3</li>
</ul>
</div>

Alignment of third level navigation in centered navigation menu out in IE

I have created a drop-down menu which works fine in Firefox but the alignment of the third level dropdown menu is out in IE, and I can't work out why.
The HTML:
<nav class="main-navigation clearfix">
<ul class=" main-nav-ul">
<li>Main Link 1</li>
<li>Dropdown
<ul>
<li>Level 2 Item 1</li>
<li>Level 2 Item 2
<ul>Level 3 Item 1
</ul>
</li>
<li>Level 2 Item 3</li>
</ul>
</li>
<li>Main Link 3</li>
</ul>
</nav>
And the CSS from styles.less file:
.main-navigation {
text-align: center;
font-family: #body-font;
}
.main-navigation ul {
li {
display: inline;
text-align: center;
position: relative;
a {
color: lighten(#dark-color, 10%);
display: inline-block;
font-size: 14px;
font-weight: bold;
height: 42px;
line-height: 42px;
margin-right: 14px;
position: relative;
&:hover {
color: black;
}
&::before {
content: '|';
position: absolute;
font-size: 10px;
right: -1em;
top: -1px;
color: lighten(#dark-color, 50%);
}
} //end a
ul {
opacity: 0;
filter: alpha(opacity=0);
visibility: hidden;
-webkit-transition: opacity 0.2s ease-in;
-moz-transition: opacity 0.2s ease-in;
-o-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
background: #light-text-color;
border: 1px solid darken(#light-text-color, 10%);
border-bottom: 0;
position: absolute;
left: -49px;
li {
float: none;
white-space: nowrap;
position: relative;
a {
padding: 0 14px;
margin-right: 0;
border-bottom: 1px solid darken(#light-text-color, 10%);
&::before {
content: '';
}
} //end a
ul {
position: absolute;
left: 92px;
top: -15px;
opacity: 0;
filter: alpha(opacity=0);
visibility: hidden;
-webkit-transition: opacity 0.2s ease-in;
-moz-transition: opacity 0.2s ease-in;
-o-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
} //end 3rd level ul
} //end 2nd level li
} //end ul
&:hover > ul {
opacity: 10;
filter: alpha(opacity=100);
visibility: visible;
}
} //end li
} //end main-navigation ul
I am using bootstrap CSS as well. I'm still quite new to CSS so my apologies if coding isn't so good!
Thanks

Position absolute and transition with chrome

it seems that Chrome and transition have got a problem with position absolute. I'm testing with Chrome 36.0. It works fine with the latest Firefox and the latest IE.
The problem is that I can't view the submenu when I pass the mouse pointer over Categorias item menu.
The code:
<!DOCTYPE html>
<html>
<head lang='es'>
<meta charset='UTF-8'>
<title>Menú Desplegable</title>
<link rel='stylesheet' href='css/styles.css' />
<link rel='stylesheet' href='css/fonts.css' />
</head>
<body>
<header>
<nav>
<ul>
<li><a href='#'><span class='primero'><i class='icon icon-house'></i></span>Inicio</a></li>
<li><a href='#'><span class='segundo'><i class='icon icon-tag'></i></span>Categorías</a>
<ul>
<li><a href='#'>Item#1</a></li>
<li><a href='#'>Item#2</a></li>
<li><a href='#'>Item#3</a></li>
<li><a href='#'>Item#4</a></li>
<li><a href='#'>Item#5</a></li>
</ul>
</li>
<li><a href='#'><span class='tercero'><i class='icon icon-suitcase'></i></span>Servicios</a></li>
<li><a href='#'><span class='cuarto'><i class='icon icon-newspaper'></i></span>Acerca De</a></li>
<li><a href='#'><span class='quinto'><i class='icon icon-mail'></i></span>Contacto</a></li>
</ul>
</nav>
</header>
</body>
</html>
And the CSS code:
* {
padding: 0;
margin: 0 auto;
}
header {
width: 100%;
}
a {
text-decoration: none;
}
nav {
margin: 20px auto;
width: 90%;
max-width: 1000px;
}
nav ul {
list-style: none;
}
nav > ul {
display: table;
overflow: hidden;
width: 100%;
background: black;
position: relative;
}
nav > ul li {
display: table-cell;
}
/*Sub-menu*/
nav > ul > li:hover > ul {
display: block;
height: 100%;
}
nav > ul > li > ul {
display: block;
position: absolute;
background: black;
left: 0;
right: 0;
overflow: hidden;
height: 0;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
nav > ul li a {
color: white;
display: block;
line-height: 20px;
padding: 20px;
position: relative;
text-align: center;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
nav > ul > li > ul > li a:hover {
background: #5da5a2;
}
nav > ul > li > a span {
background: #174459;
display: block;
height: 100%;
width: 100%;
left: 0;
position: absolute;
top: -55px;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
nav > ul > li > a span .icon {
display: block;
line-height: 60px;
}
nav > ul > li > a:hover > span {
top: 0;
}
/*Colores*/
nav ul li a .primero {
background: #0e5061;
}
nav ul li a .segundo {
background: #5da5a2;
}
nav ul li a .tercero {
background: #f25724;
}
nav ul li a .cuarto {
background: #174459;
}
nav ul li a .quinto {
background: #37a4d9;
}
It seems the problem is in this section:
nav > ul > li > ul {
display: block;
position: absolute;
If I change position to relative, then it appears the submenu when I pass the mouse pointer.
I've been reading about that around internet and it seems a bug solved since 16 or 18 Chrome version, but it doesn't seem at all for this code.
Thanks
This is fix for your css of menu, so now gonna work:
* {
padding: 0;
margin: 0 auto;
}
header {
margin-top:10px;
width: 100%;
overflow: hidden;
height: 150px;
position: relative;
}
a {
text-decoration: none;
}
nav {
top:-20px;
margin: 20px auto;
width: 90%;
max-width: 1000px;
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
}
nav ul {
list-style: none;
}
nav > ul {
display: table;
width: 100%;
background: black;
position: relative;
}
nav > ul li {
display: table-cell;
}
/*Sub-menu*/
nav > ul > li:hover > ul {
display: block;
height: 100%;
}
nav > ul > li > ul {
display: block;
position: absolute;
background: black;
left: 0;
right: 0;
overflow: hidden;
height: 0;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
nav > ul li a {
color: white;
display: block;
line-height: 20px;
padding: 20px;
position: relative;
text-align: center;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
nav > ul > li > ul > li a:hover {
background: #5da5a2;
}
nav > ul > li > a span {
background: #174459;
display: block;
height: 100%;
width: 100%;
left: 0;
position: absolute;
top: -55px;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
nav > ul > li > a span .icon {
display: block;
line-height: 60px;
}
nav > ul > li > a:hover > span {
top: 0;
}
/*Colores*/
nav ul li a .primero {
background: #0e5061;
}
nav ul li a .segundo {
background: #5da5a2;
}
nav ul li a .tercero {
background: #f25724;
}
nav ul li a .cuarto {
background: #174459;
}
nav ul li a .quinto {
background: #37a4d9;
}

I've created a drop down menu with pure CSS and I want it to be drop-up not drop-down I can't figure out what to add or change to make it drop-up

I've created a drop down menu with pure CSS and I've gotten it to a place that I like EXCEPT I want it to be "drop-up" not drop-down since the menu bar is going at the bottom of the layout. I can't figure out what to add or change to make it "drop-up," help please!!
The CSS I used:
#cssmenuf {
position: relative;
height: 50px;
background: #2b2f3a;
width: auto;
}
#cssmenuf ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 1;
}
#cssmenuf > ul {
position: relative;
display: block;
background: #2b2f3a;
height: 32px;
width: 100%;
z-index: 500;
bottom:100%;
}
#cssmenuf > ul > li {
display: block;
position: relative;
float: left;
margin: 0;
padding: 0;
}
#cssmenuf ul li a {
display: block;
font-family: Helvetica, sans-serif;
text-decoration: none;
}
#cssmenuf > ul > li > a {
font-size: 12px;
font-weight: bold;
padding: 15px 20px;
color: #7a8189;
text-transform: uppercase;
-webkit-transition: color 0.25s ease-out;
-moz-transition: color 0.25s ease-out;
-ms-transition: color 0.25s ease-out;
-o-transition: color 0.25s ease-out;
transition: color 0.25s ease-out;
}
#cssmenuf > ul > li.has-subf > a {
padding-right: 25px;
}
#cssmenuf > ul > li:hover > a {
color: #ffffff;
}
#cssmenuf li.has-subf::after {
display: block;
content: '';
position: absolute;
width: 0;
height: 0;
}
#cssmenuf > ul > li.has-subf::after {
right: 10px;
top: 20px;
border: 5px solid transparent;
border-top-color: #7a8189;
}
#cssmenuf > ul > li:hover::after {
border-top-color: #ffffff;
}
#cssmenuf ul ul {
position: absolute;
left: -9999px;
top: 70px;
opacity: 0;
-webkit-transition: opacity .3s ease, top .25s ease;
-moz-transition: opacity .3s ease, top .25s ease;
-ms-transition: opacity .3s ease, top .25s ease;
-o-transition: opacity .3s ease, top .25s ease;
transition: opacity .3s ease, top .25s ease;
z-index: 1000;
}
#cssmenuf ul ul ul {
top: 37px;
padding-left: 5px;
}
#cssmenuf ul ul li {
position: relative;
}
#cssmenuf > ul > li:hover > ul {
left: auto;
top: 44px;
opacity: 1;
}
#cssmenuf ul ul li:hover > ul {
left: 170px;
top: 0;
opacity: 1;
}
#cssmenuf ul ul li a {
width: 130px;
border-bottom: 1px solid #eee;
padding: 10px 20px;
font-size: 12px;
color: #9ea2a5;
background: #fff;
-webkit-transition: all .35s ease;
-moz-transition: all .35s ease;
-ms-transition: all .35s ease;
-o-transition: all .35s ease;
transition: all .35s ease;
}
#cssmenuf ul ul li:hover > a {
background: #f6f6f6;
color: #8c9195;
}
#cssmenuf ul ul li:last-child > a,
#cssmenu ul ul li.last > a {
border-bottom: 0;
}
#cssmenuf ul ul li.has-subf::after {
border: 4px solid transparent;
border-left-color: #9ea2a5;
right: 10px;
top: 12px;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
-o-transition: all .2s ease;
transition: all .2s ease;
-webkit-transition: -webkit-transform 0.2s ease, right 0.2s ease;
}
#cssmenuf ul ul li.has-subf:hover::after {
border-left-color: #fff;
right: -5px;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
HTML
<div id='cssmenuf'>
<ul>
<li class='active'><a href='index.html'>
<span>About Us</span></a>
</li>
<li class='active'><a href='#'>
<span>FAQ</span></a>
</li>
<li class='active'><a href='#'>
<span>Contact Us</span></a>
</li>
<li class='active'><a href='#'>
<span>Testimonial</span></a>
</li>
<li class='has-subf'><a href='#'><span>Share On</span></a>
<ul>
<li class='has-subf'><a href='#'>
<span>Facebook</span></a></li>
<li class='has-subf'><a href='#'>
<span>Google+</span></a></li>
<li class='has-subf'><a href='#'>
<span>linkedIn</span></a></li>
<li class='has-subf'><a href='#'>
<span>Twitter</span></a></li>
</ul></li>
</ul>
</div>
In "#cssmenuf ul ul" and "#cssmenuf > ul > li:hover > ul" you use "top" instead of "bottom" to position your element. Change "top: 70px;" to "bottom: 70px;" and "top: 44px;" to "bottom: 44px;" and it should work.