CSS border under/below list item - css

I have a list for my navbar. I want to have a border below the active li item, not just on the bottom.
I've been able to add the border to the bottom using border-bottom, but again, it needs to be below the li element. Any help would be appreciated.
Here is my custom css so far, in addition to default Bootstrap navbar list:
.nav .active{
border-bottom: 5px solid yellow;
}
See below:

Just an example ..... use border-bottom with background-clip padding box
ul {
list-style-type: none;
}
li {
height: 50px;
width: 180px;
line-height: 50px;
border-bottom: 5px solid transparent;
background: #ddd;
display: inline-block;
text-align: center;
background-clip: padding-box;
}
li:hover {
border-bottom: 5px solid gold;
}
<ul>
<li>Hello</li>
<li>World</li>
</ul>
Altarnatively you can try box shadow. see this
ul {
list-style-type: none;
}
li {
height: 50px;
width: 180px;
line-height: 50px;
background: #ddd;
display: inline-block;
text-align: center;
}
li:hover {
box-shadow: 0 5px 0 0 gold;
}
<ul>
<li>Hello</li>
<li>World</li>
</ul>

Try like this: demo
CSS:
ul.nav {
list-style-type: none;
}
li {
display:block;
float:left;
line-height: 26px;
margin-right:10px;
background-color:#ccc;
padding:4px 10px;
border-bottom: 5px solid transparent;
}
li a{
text-decoration:none;
color:#000;
}
li:hover, li.active {
border-bottom: 5px solid red;
}
HTML:
<ul class="nav">
<li> Menu 1
</li>
<li class="active"> Menu 1
</li>
<li> Menu 1
</li>
<li> Menu 1
</li>
</ul>

I typically use an :after for small details like this, to get the border outside the menu items normal height.
HTML:
<ul>
<li>Home</li>
<li class="active">About</li>
<li>Contact</li>
<li>Blog</li>
</ul>
<div class="main">
Next Box
</div>
CSS:
html,body{
margin:0px;
padding:0px;
}
ul{
/* for looks */
list-style:none;
margin:0px;
padding:0px;
}
li{
background:black;
color:white;
display:inline-block;
margin:0px;
padding:5px 20px;
}
li.active{
position:relative;
}
li.active:after{
content:'';
position:absolute;
top:100%;
left:0px;
border-top:5px solid yellow;
width:100%;
}
.main{
background-color:#dddddd;
min-height:400px;
}
Most of the css is just for presentation but the key stuff is on the li, the li.active, and the li.active:after.
You can check out my demo at jsfiddle

This is the sample I always use. Hope this can help you ;)
This method is using the last child of the "li" element as the border.
The class "selected" on "li" element choose the position of the border to stay at initial.
When the mouse is on one of the menu bar button, the bar will follow it by an animation.
If you don't want an animation, please just delete ALL transition CSS style in ".menu > li:last-child" class.
If you want to know more about last child CSS style, please go to this link >> http://www.w3schools.com/cssref/sel_last-child.asp
.menu, .menu li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
.menu {
margin: auto;
position: relative;
overflow: hidden;
height: 25px;
}
.menu li {padding: 0px 5px;}
.menu > li {
text-align: center;
width: 80px;
font-size: 14px;
}
.menu > li > a {
display: block;
padding: 0px 0px;
color: #444;
text-decoration: none;
font-size: 15px;
-webkit-transition: color 0.5s ease;
-moz-transition: color 0.5s ease;
-ms-transition: color 0.5s ease;
-o-transition: color 0.5s ease;
transition: color 0.5s ease;
}
.menu li a:hover {
color: #ffa500;
}
.menu > li:last-child {
position: absolute;
top: 20px;
right: -90px;
height: 5px;
width: 80px;
background: #ffa500;
-webkit-transition: transform 0.5s ease;
-moz-transition: transform 0.5s ease;
-ms-transition: transform 0.5s ease;
-o-transition: transform 0.5s ease;
transition: transform 0.5s ease;
}
.menu .selected {
position: relative;
pointer-events: none;
cursor: default;
}
.selected a {
color: #ffa500 !important;
}
.menu li:nth-child(1):hover ~ li:last-child {
-webkit-transform:translateX(-375px) !important;
-moz-transform:translateX(-375px) !important;
-ms-transform:translateX(-375px) !important;
-o-transform:translateX(-375px) !important;
transform:translateX(-375px) !important;
}
.menu li:nth-child(1).selected ~ li:last-child {
-webkit-transform:translateX(-375px);
-moz-transform:translateX(-375px);
-ms-transform:translateX(-375px);
-o-transform:translateX(-375px);
transform:translateX(-375px);
}
.menu li:nth-child(2):hover ~ li:last-child {
-webkit-transform:translateX(-280px) !important;
-moz-transform:translateX(-280px) !important;
-ms-transform:translateX(-280px) !important;
-o-transform:translateX(-280px) !important;
transform:translateX(-280px) !important;
}
.menu li:nth-child(2).selected ~ li:last-child {
-webkit-transform:translateX(-280px);
-moz-transform:translateX(-280px);
-ms-transform:translateX(-280px);
-o-transform:translateX(-280px);
transform:translateX(-280px);
}
.menu li:nth-child(3):hover ~ li:last-child {
-webkit-transform:translateX(-185px) !important;
-moz-transform:translateX(-185px) !important;
-ms-transform:translateX(-185px) !important;
-o-transform:translateX(-185px) !important;
transform:translateX(-185px) !important;
}
.menu li:nth-child(3).selected ~ li:last-child {
-webkit-transform:translateX(-185px);
-moz-transform:translateX(-185px);
-ms-transform:translateX(-185px);
-o-transform:translateX(-185px);
transform:translateX(-185px);
}
.menu li:nth-child(4):hover ~ li:last-child {
-webkit-transform:translateX(-90px) !important;
-moz-transform:translateX(-90px) !important;
-ms-transform:translateX(-90px) !important;
-o-transform:translateX(-90px) !important;
transform:translateX(-90px) !important;
}
.menu li:nth-child(4).selected ~ li:last-child {
-webkit-transform:translateX(-90px);
-moz-transform:translateX(-90px);
-ms-transform:translateX(-90px);
-o-transform:translateX(-90px);
transform:translateX(-90px);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div class="menubox">
<ul class="menu">
<li class="selected">
<a href="#">
First
</a>
</li>
<li>
<a href="#">
Second
</a>
</li>
<li>
<a href="#">
Third
</a>
</li>
<li>
<a href="#">
Forth
</a>
</li>
<li></li>
</ul>
</div>
</body>
</html>

Related

Submenu vanishes after mouse off main menu item

Could someone explain to me why navigating away from the main menu item causes the sub-menu to vanish? And possibly provide a fix. My google-foo skills are below par this morning. Thanks all.
CSS:
body, html{
margin: 0;
}
.content{
padding: 30px;
}
.nav-main{
width: 100%;
background-color: #222;
height: 70px;
color: #fff;
}
.nav-main > ul{
margin: 0;
padding: 0;
float: left;
list-style-top: none;
}
.nav-main > ul > li {
float: left;
}
.nav-item {
display: inline-block;
padding: 15px 20px;
height: 40px;
line-height: 40px;
color: #fff;
text-decoration: none;
}
.nav-item:hover{
background-color: #444;
}
.nav-content{
position: absolute;
top: 70px;
overflow: hidden;
background-color: #222; /* same color as main nav*/
max-height: 0; /*will not display if .nav-content no padding */
}
.nav-content a{
color: #fff;
text-decoration: none;
}
.nav-content a:hover{
text-decoration: underline;
}
.nav-sub{
padding: 20px;
}
.nav-sub ul{
padding: 0;
margin: 0;
list-style-type: none;
}
.nav-sub > ul > li{
display: inline-block;
}
.nav-sub ul li a{
padding: 5px 0;
}
.nav-item:focus{
background-color: #444; /*remove if click focus not necessary*/
}
.nav-item:hover ~ .nav-content{
max-height: 400px;
-webkit-transition:max-height 0.6s ease-in;
-moz-transition:max-height 0.6s ease-in;
transition:max-height 0.6s ease-in;
}
HTML:
<body>
<nav class="nav-main">
<ul>
<li>
first
<div class="nav-content">
<div class="nav-sub">
<ul>
<li>this is a thing</li>
<li>this is a thing 2</li>
</ul>
</div>
</div>
</li>
<li>
second
</li>
<li>
third
</li>
</ul>
</nav>
<div class="content">this is content</div>
</body>
I have changed:
.nav-item:hover ~ .nav-content{
To
nav > ul > li:hover > .nav-content{
And now it's working - example:
https://jsfiddle.net/saxkayv2/

HTML5/CSS overflow on dropdowns

I'm building this website as part of college project, I have built my navigation drop downs but there is a kind of over flow on the left of the list items that I can't seem to get rid of. I have tried playing around with the widths and overflow but I just can't seem to get rid of it without messing up the functionality of my dropdown, any help would be greatly appreciated.
wont let me post an image but here is a link: http://postimg.org/image/q4uo0sjfp/
This is the CSS
#charset "UTF-8";
html {background:none;}
table{
width:100%;
}
table, th, td {
height:auto;
width:auto;
padding: none;
align: center;
}
.cf:before,
.cf:after {
content:"";
display:table;
}
.cf:after {
clear:both;
}
.cf {
zoom:1;
}
body {
font: 100% Arial, Helvetica, sans-serif;
line-height: 1.4;
width: 100%;
padding-bottom: 0;
background: 8BA0BB;
}
.wrapper{
min-height:100%;
height:100%;
height:auto;
width:auto;
}
h1, h2, h3 {
font-weight: normal;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
color: #174D92;
}
h2 {
font-size: 4.4em;
font:100% Arial, Helvetica, sans-serif;
color:#174D92;
font-weight: bold;
}
header{
position:fixed;
width:100%;
height:206px;
max-width:100%;
max-height:100%;
float:left;
top:0;
left:0;
background:#ffffff;
z-index:999;
}
header img{
height:auto;
width:auto;
max-width:100%;
max-height:100%;
float:left;
}
nav {
height: 3.1em;
width:100%;
background:#174D92;
text-align:center;
position:fixed;
top:200px;
z-index:999;
}
div {
background:#7FB7FF;
margin: 2px;
border: 1px solid #174D92;
Border-radius:25px;
Padding: 2px 2px 2px 2px;
}
.insurers a img{
border: 1px solid #174D92;}
.insurers a:hover img{
border: 3px solid #174D92;
opacity:0.4;
}
div.textsmall{font-size: 85%}
ul, li {
float:left;
padding:none;
margin: 0;
list-style:none;
width: 20%;
height: auto;
text-align:center;
font-weight: bold;
}
ul {
background: #7FB7FF;
width:97.6%;
height:2.9em;
text-align: center;
vertical-align:central;
margin-top:.1em;
}
li {
position:relative;
}
li a {
display:block;
width: auto;
padding:none;
line-height:2.9em;
text-decoration:none;
color: #174D92;
}
li a:hover, .topmenu > li:hover > a{
background:#174D92;
color: #7FB7FF;
border-left: 1px solid black;
border-right: 1px solid black;
}
ul.topmenu{text-align:center;
}
ul.submenu {
background:#7FB7FF;
width: 100%;
height: auto;
float:none;
position:absolute;
top:2.9em;
left:10000em;
max-height: 0;
transition:max-height 1s ease-in-out;
-webkit-transition: max-height 1s ease-in-out;
-moz-transition: max-height 1s ease-in-out;
-o-transition: max-height 1s ease-in-out;
overflow:hidden;
z-index:999;
}
ul.submenu li {
padding: none;
float: none;
color: #174D92;
width: 100%;
height: auto;
z-index:999;
}
ul.topmenu li:hover ul{
Left:-40px;
max-height: 30em;
width: 100%;
}
ul.submenu li a {
border-bottom: 1px solid #8D8F92;
border-right: 0;
line-height:3em;
padding: none;
white-space: nowrap;
}
ul.submenu li a:hover {
background:#174D92;
color:#7FB7FF;
border-bottom: 1px solid #FFFFFF;
}
ul.submenu li:last-child a {
border-bottom: none;
}
ul.submenu li:first-child a {
padding: none;
}
.fadein { position:relative; width: auto; height: 545px; margin-top: 1em;}
.fadein img { position:absolute; left:0; top:0; border-radius:25px; border: 4px solid #174D92;}
iframe{
margin: 2px;
border: 1px solid #174D92;
}
.divtext{
width:60%;
text-align:center;
}
.aligncent{
align-content:center;
text-align:center;
}
.blank{
background:none;
border:none;
}
HTML
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link href="index.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<title>Physio Central Dublin</title>
</head>
<div class="wrapper blank" style="height:auto; width:100%">
<header><img src="headerimg.png"></header>
</div>
<body>
<nav class="cf">
<ul class="topmenu">
<li>Home</li>
<li>Treatments
<ul class="submenu">
<li>Physiotherapy</li>
<li>Acupuncture</li>
<li>Sports Injury</li>
<li>Osteopathy</li>
<li>Exercise Therapy</li>
<li>Massage Therapy</li>
<li>Orthotics</li>
<li>Dry Needling</li>
</ul>
</li>
<li>Pricing
<ul class="submenu">
<li>Pricing for sessions</li>
<li>Are you covered</li>
</ul>
</li>
<li>About Us
<ul class="submenu">
<li>About Physio Central</li>
<li>Opening Times</li>
<li>Location</li>
<li>Our People</li>
<li>Contact Us</li>
<li>Testimonies</li>
</ul>
</li>
<li>FAQ
<ul class="submenu">
<li>FAQ</li>
</ul>
</li>
</ul>
</nav>
you just need to tell the ul to have zero padding.
ul.submenu {
background:#7FB7FF;
width: 100%;
height: auto;
max-height: 0;
transition:max-height 1s ease-in-out;
-webkit-transition: max-height 1s ease-in-out;
-moz-transition: max-height 1s ease-in-out;
-o-transition: max-height 1s ease-in-out;
overflow:hidden;
z-index:999;
padding: 0px;
}
If you remove the absolute positioning as well then it will drop directly below your menu item, which I assume is what you was after as well.

Menu items and social icons do not align correctly

I am trying to load a line of social icons and then underneath that a line of menu items.
The alignment is not 100% right-aligned and in IE. Instead, the menu items get shoved all the way over to the left.
The ideal look on all browsers should be :
Code in a bootply
I'm using bootstrap 2.2.2
HTML:
<div class="row-fluid" id="top-header" style="background: #fff url(http://www.inter-active.co.za/images/background-top.jpg) top center;">
<!-- Navigation -->
<div class="sticky-wrapper" id="navigation-sticky-wrapper" style="height: 108px;">
<div class="navbar navbar-fixed-top" id="navigation">
<div class="container no-padding">
<div id="logo">
<img src="images/logo.png">
</div>
<div class="navbar-inner">
<a class="show-menu" data-target=".nav-collapse" data-toggle="collapse">
<span class="show-menu-bar"></span>
</a>
<div class="nav-collapse collapse">
<ul class="social">
<li class="social"><img alt="" src="http://www.inter-active.co.za/images/twitter.png" ></li>
<li class="social"><img alt="" src="http://www.inter-active.co.za/images/linkedin.png"></li>
<li class="social"><img alt="" src="http://www.inter-active.co.za/images/facebook.png"></li>
</ul>
<br>
<ul class="nav">
<li class="menu"><a class="colapse-menu1" href="#home">Home</a></li>
<li class="menu"><a class="colapse-menu1" href="#sectionA">About Us</a></li>
<li class="menu"><a class="colapse-menu1" href="#solutions">Solutions</a></li>
<li class="menu"><a class="colapse-menu1" href="#news">News</a></li>
<li class="menu"><a class="colapse-menu1" href="#contact-parallax">Careers</a></li>
<li class="menu"><a class="colapse-menu1" href="#contact">Contact Us</a></li>
</ul>
</div>
</div>
</div>
</div>
</div><!--/Navigation -->
</div>
CSS:
#logo {
width:180px;
height:100px;
padding:4px;
position:absolute;
}
#navigation-sticky-wrapper {
height:45px;
}
ul.socials-icons-top li {
width:35px;
height:35px;
display:inline-block
}
ul.socials-icons-top li a {
opacity:0.5;
transition:all 0.3s ease 0s;
-moz-transition:all 0.3s ease 0s;
-webkit-transition:all 0.3s ease 0s;
-o-transition:all 0.3s ease 0s;
}
ul.socials-icons-top li a:hover {
opacity:1;
}
#navigation-sticky-wrapper {
height:120px;
}
.is-sticky {
background-color:#fff;
width:100%;
height:121px;
background: #fff url(../images/background-top.jpg) top center;
width:100%;
}
.navbar-fixed-top .navbar-inner, .navbar-static-top .navbar-inner {
float:right;
margin-right:20px;
}
.navbar-inner {
box-shadow: none !important;
min-height: 45px;
line-height: 20px !important;
transition: all 0.3s ease-out 0s;
border-bottom: none !important;
padding-left: 10px !important;
padding-right: 10px !important;
background: transparent;
margin-top: 55px;
}
.navbar {
position: relative;
float:right;
padding 0 20px;
width:100%
}
li.social {
width:32px;
height:32px;
display:inline-block;
}
ul.social {
float:right;
margin-right:250px;
margin-bottom:2px;
}
.navbar .nav {
width:960px;
text-align:center;
margin: 0 10px 10px 0;
}
.navbar .nav > li {
float:none;
display:inline-block;
width:auto;
}
.navbar .nav > li.menu {
margin-right:5px;
margin-top:5px;
}
.navbar .nav > li > a {
font-family:'Calibri', 'Arial', sans-serif;
text-transform:uppercase;
font-weight:400;
font-size:14px;
color: #e76f25;
display: block;
transition: all 0.3s ease-out 0s;
line-height: 14px;
text-shadow: none;
height:16px;
padding: 0px;
}
ul.menu>li:last-child a {
border:none;
}
.navbar .nav > .active > a, .navbar .nav > .active > a:hover, .navbar .nav > .active > a:focus {
background: none;
box-shadow: none;
color: #222222;
height: 100%;
transition: all 0.3s ease-out 0s;
}
.navbar .nav > li > a:focus, .navbar .nav > li > a:hover {
color: #333;
text-decoration: none;
height: 100%;
transition: all 0.3s ease-out 0s;
}
.navbar .show-menu {
float: right;
width:30px;
margin: 7px 30px 7px 10px;
height: 31px;
padding:2px;
background:url(../images/responsive-menu.png) no-repeat 2px 2px;
background-size:30px 30px;
cursor:pointer;
border-radius:3px;
opacity:0.7;
display:none
}
.navbar .show-menu:hover {
opacity:1;
}
You have added,
a. 250px of right margin for the ul that has the class 'social'.
Figure - 1
b. And 10px of right margin for nav beneath social.
Figure - 2
To align that you need to set the text-align to right add 240px [a - b] of padding-right for nav.
Here is the CSS Code;
.navbar .nav {
margin: 0 10px 10px 0;
padding-right: 240px; /** 250px - 10px **/
text-align: right; /**/
width: 960px;
}
And additionally, there is 5px of right margin for each li in ul has a class of nav. This makes the menu links to be offset to left by 5px.
To fix that you need to add this block of CSS code;
.navbar .nav > li:last-child {
margin-right: 0;
}
Hope this will help. [This is my first Stackoverflow answer ;)]

CSS Dropdown Menu on iPad

I have a CSS drop-down menu that works perfectly on mouse hover but that only partly works on iPad & iPhone. Tapping the drop-down works the first time but fails on subsequent taps until the home link is tapped, which 'resets' the menu. Seems weird to me but maybe someone will recognize this behavior. The menu can be viewed at http://raleighfutbol4all.com/
<div id="menu">
<ul>
<li><a class="link" href="http://raleighfutbol4all.com">Home</a></li>
<li><a class="sm_parent" onClick="return true">Program</a>
<ul>
<li><a class="link" href="/program.php">Methods</a></li>
<li><a class="link" href="/schedule.php">Schedule</a></li>
<li><a class="link" href="locations.php">Locations</a></li>
<li><a class="link" href="reading.php">Reading</a></li>
</ul>
</li>
<li><a class="link" class="titlebar" href="contact.php">Contact</a></li>
<li><a class="sm_parent" onClick="return true">About</a>
<ul>
<li><a class="link" href="/about.php">The Coaches</a></li>
<li><a class="link" href="/mission.php">Mission Statement</a></li>
<li><a class="link" href="/testimonials.php">Testimonials</a></li>
<li><a class="link" href="/gallery.php">Gallery</a></li>
</ul>
</li>
</ul>
</div> <!-- menu -->
CSS:
#menu
{
display: block;
position: absolute;
white-space:nowrap;
z-index: 3;
}
#menu a.link:hover
{
color: #ffffff;
border: 1px solid #FFE135;
border-radius: 6px;
margin: 0px; /* needed to offset 1px border */
}
#menu a.sm_parent:hover /* sm_parent = submenu parent, has no link */
{
cursor: default;
}
#menu > ul /* top level ul only */
{
padding-left: 15px;
padding-right: 15px;
margin: 0;
}
#menu ul /* all ul's*/
{
display: inline-table;
position: relative;
list-style: none;
z-index: 3;
}
#menu ul li
{
float: left;
text-align: left;
}
#menu ul li a
{
display: block;
padding: 4px 20px;
color: #FFE135;
text-decoration: none;
margin: 1px; /* hover will replace this with 1px border, prevents shifting */
z-index: 3;
}
#menu ul li a:link { color: #FFE135; }
#menu ul li a:visited { color: #FFE135; }
#menu ul li a:active { color: #FFE135;}
#menu ul li:hover > ul
{
visibility: visible;
opacity: 1.0;
}
#menu ul li ul
{
visibility: hidden;
opacity: 0.0;
-webkit-transition: all 0.4s ease-in-out 0.0s;
-moz-transition: all 0.4s ease-in-out 0.0s;
-ms-transition: all 0.4s ease-in-out 0.0s;
-o-transition: all 0.4s ease-in-out 0.0s;
transition: all 0.4s ease-in-out 0.0s;
}
#menu ul ul
{
display: block;
background: black;
border-radius: 8px;
padding: 2px 8px;
position: absolute;
z-index: 3;
/*
top: 100% works with Chrrome, etc but not with IE, (of course) but not with
margin and or border values adding margin & border values between top menu (ul)
and submenu (ul) will require more % value deduction
*/
top: 88%;
}
#menu ul ul li
{
display: block;
position: relative;
float: none;
}
#menu ul ul > li
{
/* submenus with slightly smaller font */
font-size: 90%;
}
#menu ul ul li a
{
padding: 4px 10px;
}
#menu ul ul ul
{
/* 2nd generation submenu open to right of 1st generation dropdown submenus */
position: absolute; left: 100%; top:0;
}
#menu ul ul ul > li
{
/* This prevents 2nd generation > submenus from having ever diminishing font size*/
font-size: 100%;
}
First i noticed website is not responsive. most of the time drop downs not good for the Mobile equipment like IPod,Ipad and Android mobile. but if you can make responsive website with menu. you can get very good touch friendly user experience.
Here example mobile navigation : http://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly

CSS Menu Transition

JSFiddle: http://jsfiddle.net/x6bM3/
If you hover over the products link you will see i have created a drop down effect, but what im trying to do is give it a nice transition instead of it just appearing.
I have tried using :hover with the css transitions on various parts of the menu, but after researching it i realised the animation wont work with display: none; on it. Please help,
Thanks in advance,
Adam
CSS:
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
list-style: none;
position: relative;
display: inline-table;
margin-top: 23px;
padding: 0;
float: left;
}
nav ul:after {
content:"";
display: block;
}
nav ul li {
float: left;
height: 50px;
width: auto;
padding: 5px;
margin-left: 22px;
}
nav ul li a {
display: block;
text-decoration: none;
}
nav ul ul {
background: #363c43;
border-radius: 3px;
border: 1px solid #2e363f;
padding: 7px;
position: absolute;
font-size: 0.9em;
}
nav ul ul:before {
content:'';
display:block;
width:0;
height:0;
position:absolute;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom:10px solid #363c43;
top:-8px;
left: 30px;
}
nav ul ul li {
height: 30px;
float: none;
position: relative;
padding: 0px 0px 5px 0px;
margin: 0px;
}
/* Other base styles */
* {
font-family: arial;
}
a:link, a:visited {
color: #979797;
font-size: 1.145em;
/* 18px */
text-decoration: none;
font-weight: lighter;
-webkit-transition: all .25s linear;
transition: color .25s linear;
}
a:hover {
color: #c4c1c1;
font-size: 1.145em;
/* 22px */
text-decoration: none;
}
HTML:
<nav>
<ul class="menu">
<li>home
</li>
<li>products
<ul>
<li>product 1
</li>
<li>product 2
</li>
</ul>
</li>
<li>solutions
</li>
</ul>
</nav>
I can explain in detail, but this person does a great job: https://stackoverflow.com/a/3332179/363605
nav ul ul {
display: block;
-webkit-transition: opacity 1s ease-in;
-moz-transition: opacity 1s ease-in;
-o-transition: opacity 1s ease-in;
transition: opacity 1s ease-in;
opacity: 0;
height: 0;
overflow: hidden;
}
nav ul li:hover > ul {
height: auto;
opacity: 1;
}
http://jsfiddle.net/pYhrk/

Resources