How to select parents sibling with CSS? [duplicate] - html

This question already has answers here:
Is there a CSS parent selector?
(33 answers)
Closed 6 years ago.
When I hover on the first <li>, I want to change the background-color of the .arrow-tip class. Can you help me find the correct CSS rule?
HTML:
<nav>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</nav>
<div class="arrow-tip">A triangle tip for the nav menu</div>
CSS:
nav > ul > li:nth-child(1):hover ~ .arrow-tip {
background-color: #FF0;
}
I want a PURE CSS Solution for this.

No, it's not possible with CSS currently, read this.
However, I guess you could do something like this JsFiddle instead.
ul {
list-style: none;
padding: 0;
width: 45px;
text-align: center;
position: relative;
}
li {
background: silver;
margin: 0 0 5px;
}
li:after {
content:"\25be";
font-size: 2em;
position: absolute;
left: 10px;
top: 35px;
}
li:hover:after {
z-index: 1;
}
li:nth-child(1):hover:after {
color: red;
}
li:nth-child(2):hover:after {
color: blue;
}
<ul>
<li>A</li>
<li>B</li>
</ul>
Edit: Here is the JsFiddle for what OP really wants to achieve.
Please follow the comments above if you're interested.
.menu {
list-style: none;
padding: 0;
}
.menu > li {
position: relative;
background: fuchsia;
width: 100px;
height: 20px;
display: inline-block;
vertical-align: top;
}
.submenu {
position: absolute;
top: 0;
left: 0;
width: 100%;
list-style: none;
padding: 30px 0 0;
margin: 0;
}
.submenu > li {
background: fuchsia;
display: block;
}
.submenu > li:before {
content: "";
position: absolute;
top: 20px;
left: 50%;
margin-left: -10px;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid aqua;
z-index: -1;
}
/* hide */
.submenu {
display: none;
}
/* hover */
.menu > li:hover {
background: aqua;
}
.menu > li:hover > ul {
display: block;
}
.submenu > li:hover {
background: aqua;
}
.submenu li:not(:nth-child(1)):hover:before {
border-bottom: 10px solid fuchsia;
z-index: 0;
}
<ul class="menu">
<li>one
<ul class="submenu">
<li>a</li>
<li>b</li>
<li>x</li>
<li>y</li>
<li>z</li>
</ul>
</li>
<li>two
<ul class="submenu">
<li>c</li>
<li>d</li>
</ul>
</li>
<li>three
<ul class="submenu">
<li>e</li>
<li>f</li>
</ul>
</li>
<li>four
<ul class="submenu">
<li>g</li>
<li>h</li>
</ul>
</li>
</ul>

Related

Dropdown Menu Showing Empty Results

I was just trying to make a dropdown menu, but my code does not work. Pls let me know what is the error. Like it is only showing empty dropdown on Hover just increasing its width and not showing any links in it. Pls Pls help me find the solution I am stucked on this prob. since one whole month. Here is the code...
.contain ul{
list-style: none;
margin-top: 40px;
position:relative;
bottom: 15px;
z-index: 99999999999999999;
overflow-y: hidden;
position: absolute;
top: 150px;
}
.contain ul li {
background: cadetblue;
width: 170px;
border: 1px solid #fff;
height: 50px;
line-height: 50px;
text-align: center;
float: left;
color: #fff;
font-size: 16px;
position: relative;
text-transform: uppercase;
font-weight: bold;
z-index: 99999999999999999;
}
.contain ul li:hover{
background-color:green;
height: 250px;
width: 250px;
z-index: 99999999999999999;
}
.contain ul ul{
display: none;
z-index: 99999999999999999;
height: 40
}
::-webkit-scrollbar {
width: 7px;
background-color: orange;
height: 20px;
}
<div class="contain">
<ul>
<li>HOME
<ul>
<li>Welcome Page</li>
<li>Main Page</li>
</ul>
</li>
<li>ABOUT US
<ul>
<li>Our Motto</li>
<li>Principal's Messgae</li>
<li>Organization</li>
</ul>
</li>
<li>ADMISSIONS
<ul>
<li>Registration</li>
<li>Subjects</li>
<li>Fee Structure</li>
</ul>
</li>
<li>Academics
<ul>
<li>School Timings</li>
<li>Faculty</li>
<li>CBSE</li>
</ul>
</li>
<li>CONTACT US
<ul>
<li>+91-995 828 4006</li>
<li>jpsnoida#jaypeeschools.edu.in</li>
</ul>
</li>
</ul>
</div>
Dropdown menu is display: none, so that you need to CSS for that
.contain ul li:hover ul {
display: block;
}
Also, I have added some CSS to display proper dropdown on hover.
.contain ul{
list-style: none;
margin-top: 40px;
position:relative;
}
.contain ul li {
background: cadetblue;
width: 170px;
border: 1px solid #fff;
height: 50px;
line-height: 50px;
text-align: center;
float: left;
color: #fff;
font-size: 16px;
position: relative;
text-transform: uppercase;
font-weight: bold;
}
.contain ul li:hover{
background-color:green;
}
.contain ul li:hover ul {
display:block;
z-index: 10;
}
.contain ul ul{
display: none;
position: absolute;
background: cadetblue;
top: 51px;
left: 0;
padding: 0;
margin: 0;
min-width: 250px;
}
.contain ul ul li {
width: 100%;
display: block;
}
::-webkit-scrollbar {
width: 7px;
background-color: orange;
height: 20px;
}
<div class="contain">
<ul>
<li>HOME
<ul>
<li>Welcome Page</li>
<li>Main Page</li>
</ul>
</li>
<li>ABOUT US
<ul>
<li>Our Motto</li>
<li>Principal's Messgae</li>
<li>Organization</li>
</ul>
</li>
<li>ADMISSIONS
<ul>
<li>Registration</li>
<li>Subjects</li>
<li>Fee Structure</li>
</ul>
</li>
<li>Academics
<ul>
<li>School Timings</li>
<li>Faculty</li>
<li>CBSE</li>
</ul>
</li>
<li>CONTACT US
<ul>
<li>+91-995 828 4006</li>
<li>jpsnoida#jaypeeschools.edu.in</li>
</ul>
</li>
</ul>
</div>
Did small changes
.contain ul li:hover ul {
display: block;
}
.contain ul {
list-style: none;
margin-top: 40px;
position: relative;
bottom: 15px;
z-index: 99999999999999999;
overflow-y: hidden;
position: absolute;
top: 150px;
}
.contain ul li {
background: cadetblue;
width: 170px;
border: 1px solid #fff;
height: 50px;
line-height: 50px;
text-align: center;
float: left;
color: #fff;
font-size: 16px;
position: relative;
text-transform: uppercase;
font-weight: bold;
z-index: 99999999999999999;
}
.contain ul li:hover {
background-color: green;
height: 250px;
width: 250px;
z-index: 99999999999999999;
}
.contain ul ul {
display: none;
z-index: 99999999999999999;
height: 40
}
::-webkit-scrollbar {
width: 7px;
background-color: orange;
height: 20px;
}
.contain ul li:hover ul {
display: block;
}
<div class="contain">
<ul>
<li>HOME
<ul>
<li>Welcome Page</li>
<li>Main Page</li>
</ul>
</li>
<li>ABOUT US
<ul>
<li>Our Motto</li>
<li>Principal's Messgae</li>
<li>Organization</li>
</ul>
</li>
<li>ADMISSIONS
<ul>
<li>Registration</li>
<li>Subjects</li>
<li>Fee Structure</li>
</ul>
</li>
<li>Academics
<ul>
<li>School Timings</li>
<li>Faculty</li>
<li>CBSE</li>
</ul>
</li>
<li>CONTACT US
<ul>
<li>+91-995 828 4006</li>
<li>jpsnoida#jaypeeschools.edu.in</li>
</ul>
</li>
</ul>
</div>
Your css lacks the display assignment;
.contain ul li:hover ul {display: block;}
you can also find correct code sample in Here

Hover effect when click on menu

I have a menu in HTML with submenus that are displayed when hovering over the main button, but I would like to know if it is possible to make the submenus appear when click on the button.
*Configurações Padrões*/ ul.menu,
.menu li,
.menu a {
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
}
ul.menu ul {
position: absolute;
display: none;
}
ul.menu {
float: left;
font-family: Verdana, Geneva, sans-serif;
font-size: 15px;
padding: 0 5px;
margin: 0px -8px;
width: 100%;
position: fixed;
bottom: 0;
}
/* Configurações nivel 1*/
.menu li {
float: left;
width: auto;
position: relative;
}
.menu li a {
display: block;
padding: 0 20px;
line-height: 45px;
height: 45px;
float: left;
}
/* Configurações nivel 2*/
.menu li:hover>ul.submenu-1 {
display: block;
top: -145px;
left: 0;
padding: 5px;
width: 200px;
}
.menu ul.submenu-1 a {
width: 160px;
padding: 0 20px;
}
/* Configurações nivel 2*/
.menu li:hover>ul.submenu-2 {
display: block;
top: 0;
left: 135px;
padding: 5px;
width: 200px;
}
.menu ul.submenu-2 a {
width: 140px;
padding: 0 20px;
}
/* Configurações nivel 3*/
.menu li:hover>ul.submenu-3 {
display: block;
top: 0;
left: 195px;
padding: 5px;
width: 200px;
}
.menu ul.submenu-3 a {
width: 160px;
padding: 0 20px;
}
/*Configurações de cores*/
/*nivel 1*/
.menu {
background: #CCC;
}
.menu a {
color: #000;
}
.menu li:hover>a {
background: #999;
color: #fff;
}
/*nivel 2*/
.submenu-1 {
background: #999;
}
.submenu-1 a {
color: #fff;
}
.submenu-1 li:hover>a {
background: #666;
}
/*nivel 3*/
.submenu-2 {
background: #666;
}
.submenu-2 a {
color: #fff;
margin-top: -4px;
}
.submenu-2 li:hover>a {
background: #333;
}
/*nivel 3*/
.submenu-3 {
background: #333;
}
.submenu-3 a {
color: #fff;
}
.submenu-3 li:hover>a {
background: #000;
}
.menuul li:hover,
ul li.active {}
<ul class="menu">
<li>Iniciar
<ul class="submenu-1">
<li>Submenu 1
<ul class="submenu-3">
<li>Submenu 7</li>
<li>Submenu 8</li>
<li>Submenu 9</li>
</ul>
</li>
<li>Submenu 2</li>
<li>Submenu 3</li>
<ul class="submenu-2">
<li>Submenu 4</li>
<li>Submenu 5</li>
<li>Submenu 6</li>
</ul>
</li>
</ul>
</li>
</ul>
I need something like the windows98 style button of this site:
http://osrollers.tumblr.com/
Add a click event to the list element.
Toggle the desired element with a CSS class via classList.toggle().
var menuLi = document.querySelector(".menu li");
var submenu1 = document.querySelector(".submenu-1");
menuLi.addEventListener("click", function() {
submenu1.classList.toggle("toggle-submenu-1");
});
*Configurações Padrões*/ ul.menu,
.menu li,
.menu a {
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
}
ul.menu ul {
position: absolute;
display: none;
}
ul.menu {
float: left;
font-family: Verdana, Geneva, sans-serif;
font-size: 15px;
padding: 0 5px;
margin: 0px -8px;
width: 100%;
position: fixed;
bottom: 0;
}
/* Configurações nivel 1*/
.menu li {
float: left;
width: auto;
position: relative;
}
.menu li a {
display: block;
padding: 0 20px;
line-height: 45px;
height: 45px;
float: left;
}
/* Configurações nivel 2*/
.toggle-submenu-1 {
display: block !important;
top: -145px;
left: 0;
padding: 5px;
width: 200px;
}
/*.menu li:hover>ul.submenu-1 {
display: block;
top: -145px;
left: 0;
padding: 5px;
width: 200px;
}*/
.menu ul.submenu-1 a {
width: 160px;
padding: 0 20px;
}
/* Configurações nivel 2*/
.menu li:hover>ul.submenu-2 {
display: block;
top: 0;
left: 135px;
padding: 5px;
width: 200px;
}
.menu ul.submenu-2 a {
width: 140px;
padding: 0 20px;
}
/* Configurações nivel 3*/
.menu li:hover>ul.submenu-3 {
display: block;
top: 0;
left: 195px;
padding: 5px;
width: 200px;
}
.menu ul.submenu-3 a {
width: 160px;
padding: 0 20px;
}
/*Configurações de cores*/
/*nivel 1*/
.menu {
background: #CCC;
}
.menu a {
color: #000;
}
.menu li:hover>a {
background: #999;
color: #fff;
}
/*nivel 2*/
.submenu-1 {
background: #999;
}
.submenu-1 a {
color: #fff;
}
.submenu-1 li:hover>a {
background: #666;
}
/*nivel 3*/
.submenu-2 {
background: #666;
}
.submenu-2 a {
color: #fff;
margin-top: -4px;
}
.submenu-2 li:hover>a {
background: #333;
}
/*nivel 3*/
.submenu-3 {
background: #333;
}
.submenu-3 a {
color: #fff;
}
.submenu-3 li:hover>a {
background: #000;
}
.menuul li:hover,
ul li.active {}
<ul class="menu">
<li>Iniciar
<ul class="submenu-1">
<li>Submenu 1
<ul class="submenu-3">
<li>Submenu 7</li>
<li>Submenu 8</li>
<li>Submenu 9</li>
</ul>
</li>
<li>Submenu 2</li>
<li>Submenu 3</li>
<ul class="submenu-2">
<li>Submenu 4</li>
<li>Submenu 5</li>
<li>Submenu 6</li>
</ul>
</li>
</ul>
</li>
</ul>
If you want activate the submenus on click, instead of mouse over, you have to use a small JavaScript code.
Please, see the comments in the snippet!
// collect each menu item
const links = document.querySelectorAll(".menu>li>a");
// run a loop
for (let i=0; i<links.length; i++)
{
// to bind a click event listener to each menu item
links[i].addEventListener("click", function()
{
// do stuff only if the current item has a submenu
if (this.nextSibling != null)
{
// cache the submenu of the current item
let submenu = this.nextSibling.nextSibling;
// check if the submenu is already visible
if (submenu.classList.contains("active"))
{
// if so, hide it
submenu.classList.remove("active");
}
else
{
// if not, show it
submenu.classList.add("active");
}
}
});
}
.submenu {
display: none;}
.submenu.active {
display: block;}
<ul class="menu">
<li>Main
<ul class="menu submenu">
<li>1
<ul class="menu submenu">
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
</ul>
</li>
<li>2</li>
<li>3
<ul class="menu submenu">
<li>3.1</li>
<li>3.2</li>
<li>3.3</li>
</ul>
</li>
</ul>
</li>
</ul>

Hover problems nav bar (HTML/CSS)

I've made a nav bar and I'd like to use the hover selector only on the pages that aren't active. So I used the selector a:not(.active):hover but it doesn't work. I'd really appreciate if someone could help me.
ul
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
display:block;
position:absolute;
top:-2px;
left:0;
right: 0;
background-color: darkred;
}
li
{
float: left;
}
li a
{
display: block;
color: white;
text-align: center;
padding: 20px 23px;
text-decoration: none;
}
li a:not(.active):hover
{
background-color: #B22222;
}
.active {
background-color: #470005;
}
<ul>
<li class="active">Home</li>
<li>About me</li>
<li>Contacts</li>
<li>Help</li>
<li>Other Works</li>
<li>News</li>
</ul>
Your :not pseudo-class is on your link. However, the active class is on the li.
li:not(.active) a:hover should work
JSfiddle Example: https://jsfiddle.net/ubntkk46/
The class is linked to your li element, not the hyperlink
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
display: block;
position: absolute;
top: -2px;
left: 0;
right: 0;
background-color: darkred;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 20px 23px;
text-decoration: none;
}
li:not(.active) a:hover {
background-color: #B22222;
}
.active {
background-color: #470005;
}
<ul>
<li class="active">Home</li>
<li>About me</li>
<li>Contacts</li>
<li>Help</li>
<li>Other Works</li>
<li>News</li>
</ul>
You could just apply the same background colour to the active a tag and the active a tags hover state, and a different background colour to the the non active a tags hover states. This would allow it to work in IE8, because :not isn't supported in older versions of IE.
ul
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
display:block;
position:absolute;
top:-2px;
left:0;
right: 0;
background-color: darkred;
}
li
{
float: left;
}
li a
{
display: block;
color: white;
text-align: center;
padding: 20px 23px;
text-decoration: none;
}
li a:hover {
background-color: #B22222;
}
li.active a, li.active a:hover {
background-color: #470005;
}
<ul>
<li class="active">Home</li>
<li>About me</li>
<li>Contacts</li>
<li>Help</li>
<li>Other Works</li>
<li>News</li>
</ul>
This Fix It :
li:not(.active):hover a {
}
Full Code:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
display:block;
position:absolute;
top:-2px;
left:0;
right: 0;
background-color: darkred;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 20px 23px;
text-decoration: none;
}
li:not(.active):hover a {
background-color: #B22222;
}
.active {
background-color: #470005;
}
<ul>
<li class="active">Home</li>
<li>About me</li>
<li>Contacts</li>
<li>Help</li>
<li>Other Works</li>
<li>News</li>
</ul>

How to hide submenu until it is hovered over by mouse

I am currently working on a navigation bar for a website, but I am having trouble with the submenu. I have figured out how to position the submenu relative to it's parent ul, but I am having trouble on making the submenu disappear until the user hovers over the parent.
So when I hover over the "Crisis and Support" I expect not to see the secondary submenu until I hover over the "Resources" tab. Can anyone help figure out what am I doing wrong?
Here is a [live example][1]
/* Navigation Bar */
/* Styles color and interaction, as well as continuous position on scroll. */
.nav {
position: relative;
color: white;
background: -webkit-linear-gradient(#182B52, #1D355E);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(#182B52, #1D355E);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#182B52, #1D355E);
/* For Firefox 3.6 to 15 */
background: linear-gradient(#182B52, #1D355E);
/* Standard syntax (must be last) */
box-shadow: 0 0 10px 0px black;
position: -webkit-sticky;
z-index: 1;
}
.nav button {
padding: 10px;
background: #182B52;
color: white;
border-style: solid;
border-top-style: none;
border-color: white;
border-width: 1px;
margin-left: 47%;
margin-bottom: 15px;
}
.nav button:hover {
background: #D3B663;
}
.nav-wrapper {
width: 100%;
margin: 0 auto;
text-align: left;
}
.nav ul {
list-style-type: none;
padding: 0;
margin: 0;
position: relative;
}
.nav ul li {
display: inline-block;
}
.nav ul li:hover {
background-color: #1D355E;
}
.nav ul li a,
visited {
color: white;
display: block;
padding: 15px;
text-decoration: none;
}
.nav ul li a:hover {
color: white;
text-decoration: none;
}
.nav ul li:hover ul {
display: block;
}
.nav ul ul {
display: none;
position: absolute;
background-color: rgba(29, 53, 94, .75);
}
.nav ul ul li {
display: block;
text-align: left;
}
.nav ul ul li a,
visited {
color: white;
}
.nav ul ul li a:hover {
color: #D3B663;
display: block;
}
.nav ul.submenu {
display: none;
position: absolute;
left: 153px;
top: 147px;
width: 150px;
text-align: center;
}
.nav ul.submenu li {
text-align: left;
color: white;
}
.nav li:hover ul.submenu:hover {
color: #D3B663;
display: block;
}
.nav-wrapper img {
float: right;
height: 75px;
padding-right: 70px;
}
.sticky {
position: fixed;
width: 100%;
left: 0;
top: 0;
z-index: 100;
border-top: 0;
}
.nav form {
position: absolute;
right: 0;
padding-right: 75px;
margin-top: -18px;
}
.nav input {
border: solid;
border-color: white;
border-width: 1px;
color: white;
background-color: #182B52;
padding: 6px;
padding-top: 8px;
}
.nav input:hover {
background: #1D355E;
}
<!-- Navigation Bar -->
<div class="nav">
<!-- Quick Close -->
<button id="get-away">QUICK CLOSE</button>
<!-- Search Bar
<form action="./search.php" method="get">
<input type="text" name="input" size="40px"/>
<input type="submit" value="SEARCH"/>
</form> -->
<!-- Sticky Navigation -->
<div class="nav-wrapper">
<ul>
<li>
ABOUT US
<ul>
<li>OUR HER-STORY</li>
<li>WHY A WOMEN'S CENTER?</li>
<li>LEARN ABOUT OUR SPACE</li>
<li>MEET OUR STAFF
<li>CONTACT US</li>
</ul>
</li>
<li>
CRISIS & SUPPORT
<ul>
<li>FIND COMMUNITY</li>
<li>BASIC RIGHTS</li>
<li>HEALTH</li>
<li>RESOURCES FOR</li>
<ul class="submenu">
<li>Category 1</li>
<li>Category 2</li>
<li>Category 3</li>
<li>Category 4</li>
<li>Category 5</li>
</ul>
</li>
<li>FOR EDUCATORS</li>
</ul>
</li>
<li>
GET INVOLVED
<ul>
<li>VOLUNTEER</li>
<li>JOIN PEER EDUCATION</li>
<li>BECOME A SAGE AFFILIATE</li>
<li>GET WRRC UPDATES</li>
<li>STUDENT STAFF POSITIONS</li>
</ul>
</li>
<li>
</li>
</ul>
</div>
</div>
Thank you for your time!
On you stylesheet (line 72) change
.nav ul li:hover ul {
display: block;
}
to
.nav ul li:hover > ul {
display: block;
}
You also have a submenu improperly nested. The closing tag for "Resources For" should come after the submenu -- you probably know that.
Codepen: http://codepen.io/SteveClason/pen/oxRyxY

CSS dropdown, Align nested UL to right edge of parent LI

All nested ULs need to be aligned to the right of their parent LI. Currently the nested ULs seem to be aligning to to the right of a higher level NAV element instead.
Live Code
Link here to fiddle with HTML and problem CSS
HTML
<body>
<div id="header">
<div id="header-content-container"> Logo!
<div id="top-nav-container">
<nav>
<ul>
<li>HOME
</li>
<li>SERVICES
<ul>
<li>Item 00000000
</li>
<li>Item 000000000000000
</li>
<li>Item 000000000000000
</li>
<li>Item 00000000000000
</li>
<li>Item 0000000000000
</li>
<li>Item 000000000000
</li>
<li>Item 000000000
</li>
</ul>
</li>
<li><a herf="#">LIBRARY</a>
</li>
<li>CONTACT
<ul>
<li>Item 0
</li>
<li>Item 00
</li>
<li>Item 000
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="clearer"></div>
</body>
CSS
.clearer {
clear: both;
}
body {
background: none repeat scroll 0 0 red;
font-family:sans-serif;
font-size: 13px;
margin: 0;
padding: 0;
position: relative;
vertical-align: baseline;
}
div#header {
background-color: white;
float: left;
height: 76px;
margin: 0;
padding: 0;
width: 100%;
}
div#header-content-container {
height: 100%;
margin: 0;
width: 768px;
background: black;
}
a#logo {
background: blue;
float: left;
height: 50px;
margin: 12px 0 0 19px;
width: 260px;
}
#top-nav-container {
float: right;
margin: 10px 0 0;
position: relative;
z-index: 9000;
}
nav {
float: right;
margin: 0 9px 0 0;
}
nav ul {
display: inline-table;
list-style: outside none none;
padding: 0;
position: relative;
}
nav ul::after {
clear: both;
content:"";
display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: green;
}
nav ul li:hover > ul {
display: block;
}
nav ul li a {
color: #eee;
display: block;
padding: 16px 15px;
text-decoration: none;
}
nav ul li:hover a {
color: orange;
}
nav ul ul {
background: none repeat scroll 0 0 #343434;
border-radius: 0;
left: auto;
padding: 0;
position: absolute;
right: 0;
top: 100%;
display: none;
}
nav ul ul li {
float: none;
border-top: 1px solid purple;
border-bottom: 1px solid blue;
position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: yellow;
}
nav ul ul li a:hover {
background: cyan;
}
Problem
Check the updated fiddle.
I have modified the nav ul ul class
nav ul ul { background: none repeat scroll 0 0 #343434;
border-radius: 0;
padding: 0;
position: absolute;
left: -48px;
top: 100%;
display: none;
}