I want to create 2 submenus when the menu in the sidebar is clicked
Here what i've done
$(document).ready(function () {
$("[data-toggle]").click(function () {
var toggle_el = $(this).data("toggle");
$(toggle_el).toggleClass("open-sidebar");
});
$('.parent').click(function () {
$('.submenu').toggle('visible');
});
});
body, html {
height: 100%;
margin: 0;
overflow:hidden;
font-family: helvetica;
font-weight: 100;
}
.container {
position: relative;
height: 100%;
width: 100%;
right: 0;
-webkit-transition: right 0.4s ease-in-out;
-moz-transition: right 0.4s ease-in-out;
-ms-transition: right 0.4s ease-in-out;
-o-transition: right 0.4s ease-in-out;
transition: right 0.4s ease-in-out;
}
.container.open-sidebar {
right: 240px;
}
#sidebar {
position: absolute;
right: -240px;
background: #DF314D;
width: 240px;
height: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
border-radius: 4px;
}
#sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}
#sidebar ul li {
margin: 0;
}
#sidebar ul li a {
padding: 15px 20px 15px 35px;
font-size: 16px;
font-weight: 100;
color: white;
text-decoration: none;
display: block;
border-bottom: 1px solid #C9223D;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
-ms-transition: background 0.3s ease-in-out;
-o-transition: background 0.3s ease-in-out;
transition: background 0.3s ease-in-out;
}
#sidebar li:hover {
background: #C9223D;
border-radius: 4px;
}
.main-content {
width: 100%;
height: 100%;
padding: 10px;
box-sizing: border-box;
-moz-box-sizing: border-box;
position: relative;
}
.main-content .content{
box-sizing: border-box;
-moz-box-sizing: border-box;
padding-left: 60px;
width: 100%;
}
.main-content .content h1{
font-weight: 100;
}
.main-content .content p{
width: 100%;
line-height: 160%;
}
.main-content #sidebar-toggle {
background: #DF314D;
border-radius: 3px;
display: block;
position: relative;
padding: 10px 7px;
float: right;
}
.main-content #sidebar-toggle .bar{
display: block;
width: 18px;
margin-bottom: 3px;
height: 2px;
background-color: #fff;
border-radius: 1px;
}
.main-content #sidebar-toggle .bar:last-child{
margin-bottom: 0;
}
.main-content #sidebar-toggle .bar{
display: block;
width: 18px;
margin-bottom: 3px;
height: 2px;
background-color: #fff;
border-radius: 1px;
}
.main-content #sidebar-toggle .bar:last-child{
margin-bottom: 0;
}
.menu a.home {
display: inline-block;
background: url(../imagenes/bpi.png) no-repeat 4px 10px;
}
.menu a.explore {
display: inline-block;
background: url(../imagenes/gasi.png) no-repeat 4px 10px;
}
.menu a.users {
display: inline-block;
background: url(../imagenes/bicici.png) no-repeat 4px 10px;
}
.menu a.signout {
display: inline-block;
background: url(../imagenes/bai.png) no-repeat 4px 10px;
}
#sidebar .menu .submenu {
display: none;
}
#sidebar ul li ul.visible{
display: block;
}
.submenu a.home {
display: inline-block;
background: url(../imagenes/bpi.png) no-repeat 4px 10px;
}
.submenu a.users {
display: inline-block;
background: url(../imagenes/bicici.png) no-repeat 4px 10px;
}
.submenu a.signout {
display: inline-block;
background: url(../imagenes/bai.png) no-repeat 4px 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<div class="container">
<div id="sidebar">
<ul class="menu">
<li class="parent">Home ></li>
<ul class="submenu">
<li>Home 11</li>
<li>Home 12</li>
<li>Home 13</li>
</ul>
<li>Explore</li>
<li> Users</li>
<li class="parent"> Sign Out ></li>
<ul class="submenu">
<li>Home 11</li>
<li>Home 12</li>
<li>Home 13</li>
</ul>
</ul>
</div>
<div class="main-content">
<a href="#" data-toggle=".container" id="sidebar-toggle">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</a>
<div class="content">
</div>
</div>
</div>
Related
nav{
display: block;
text-align: center;
}
.theme_tabs{
list-style: none;
padding-left: 0;
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.theme_tab_item.active{
border-top-color: #0069ff;
}
.theme_tab_item{
display: block;
border-top: 2px solid #e5e8ed;
padding: 16px;
transition: border-left-color .25s linear;
float: left;
}
.theme_tab_item.active a{
color: #031b4e;
cursor: default;
}
.theme_tab_item a{
color: rgba(3,27,78,.5);
font-size: 18px;
transition: color .25s linear;
}
<nav>
<ul class="theme_tabs small_margin">
<li class="theme_tab_item active">
<a>Example1</a>
</li>
<li class="theme_tab_item">
<a>Example2</a>
</li>
<li class="theme_tab_item">
<a>Example3</a>
</li>
</ul>
</nav>
Anyone can please help me How can I horizontally center navigation bar? I tried margin 0 auto but that was not working anyone can please tell me any alter way to achieve this result?
Just add display: inline-block to your .theme-tabs class and remove width: 100%.
.theme_tabs{
list-style: none;
padding-left: 0;
display: inline-block;
max-width: 1200px;
margin: 0 auto;
}
Add the following style
.theme_tabs{
display: flex;
justify-content: center;
}
nav{
display: block;
text-align: center;
}
.theme_tabs{
display: flex;
justify-content: center;
list-style: none;
padding-left: 0;
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.theme_tab_item.active{
border-top-color: #0069ff;
}
.theme_tab_item{
display: block;
border-top: 2px solid #e5e8ed;
padding: 16px;
transition: border-left-color .25s linear;
float: left;
}
.theme_tab_item.active a{
color: #031b4e;
cursor: default;
}
.theme_tab_item a{
color: rgba(3,27,78,.5);
font-size: 18px;
transition: color .25s linear;
}
<nav>
<ul class="theme_tabs small_margin">
<li class="theme_tab_item active">
<a>Example1</a>
</li>
<li class="theme_tab_item">
<a>Example2</a>
</li>
<li class="theme_tab_item">
<a>Example3</a>
</li>
</ul>
</nav>
try setting its position: relative
its left: 50%
and try playing around with transform so you can center it.
nav{
display: block;
text-align: center;
}
.theme_tabs{
list-style: none;
padding-left: 0;
width: 100%;
max-width: 1200px;
transform: translate(-25%, 0);
position: relative;
left: 50%;
display: inline-block;
}
.theme_tab_item.active{
border-top-color: #0069ff;
}
.theme_tab_item{
display: block;
border-top: 2px solid #e5e8ed;
padding: 16px;
transition: border-left-color .25s linear;
float: left;
}
.theme_tab_item.active a{
color: #031b4e;
cursor: default;
}
.theme_tab_item a{
color: rgba(3,27,78,.5);
font-size: 18px;
transition: color .25s linear;
}
<nav>
<ul class="theme_tabs small_margin">
<li class="theme_tab_item active">
<a>Example1</a>
</li>
<li class="theme_tab_item">
<a>Example2</a>
</li>
<li class="theme_tab_item">
<a>Example3</a>
</li>
</ul>
</nav>
Method A)
.theme_tab_item {
display: block;<--------change to inline-block
float: left;<-----------remove
//other codes
}
nav{
display: block;
text-align: center;
}
.theme_tabs{
list-style: none;
padding-left: 0;
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.theme_tab_item.active{
border-top-color: #0069ff;
}
.theme_tab_item{
display: inline-block;
border-top: 2px solid #e5e8ed;
padding: 16px;
transition: border-left-color .25s linear;
}
.theme_tab_item.active a{
color: #031b4e;
cursor: default;
}
.theme_tab_item a{
color: rgba(3,27,78,.5);
font-size: 18px;
transition: color .25s linear;
}
<nav>
<ul class="theme_tabs small_margin">
<li class="theme_tab_item active"><a>Example1</a></li>
<li class="theme_tab_item"><a>Example2</a></li>
<li class="theme_tab_item"><a>Example3</a></li>
</ul>
</nav>
Method B)
.theme_tabs{
width: 100%;<-----remove
display: inline-block;<----add
//Other codes...
}
nav{
display: block;
text-align: center;
}
.theme_tabs{
list-style: none;
padding-left: 0;
display: inline-block;
max-width: 1200px;
margin: 0 auto;
}
.theme_tab_item.active{
border-top-color: #0069ff;
}
.theme_tab_item {
display: block;
border-top: 2px solid #e5e8ed;
padding: 16px;
transition: border-left-color .25s linear;
float: left;
}
.theme_tab_item.active a{
color: #031b4e;
cursor: default;
}
.theme_tab_item a {
color: rgba(3,27,78,.5);
font-size: 18px;
transition: color .25s linear;
}
<nav>
<ul class="theme_tabs small_margin">
<li class="theme_tab_item active"><a>Example1</a></li>
<li class="theme_tab_item"><a>Example2</a></li>
<li class="theme_tab_item"><a>Example3</a></li>
</ul>
</nav>
I am trying to make a website. I decided to make the navigation bar have a fixed position so when I scroll down I can always see it but, when I add to the nav element the property position:fixed it just disappears. Cant' figure out what's happening. Can someone explain, what I'm doing wrong? Thank you very much!
P.S: I am new to coding.
HTML and CSS
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html,
body {
width: 100%;
height: 100%;
}
header nav #logo {
width: 140px;
position: absolute;
top: 15px;
}
nav {
position: relative;
background-color: #242628;
height: 70px;
padding-left: 20px;
}
nav ul {
position: absolute;
height: 100%;
margin: auto;
top: 0;
bottom: 0;
width: 600px;
padding-left: 200px;
}
nav ul li {
-moz-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
display: inline;
float: left;
height: inherit;
width: 100px;
border-right: 1px solid gray;
}
nav ul li:hover {
background-color: rgba(12, 240, 255, 0.3);
}
nav ul li a {
color: white;
text-decoration: none;
position: absolute;
height: inherit;
width: inherit;
text-align: center;
padding-top: 25px;
}
<header>
<nav>
<img id="logo" src="images/logo.png" alt="logo" />
<ul>
<li>Home</li>
<li>Rate it!</li>
<li>Courses</li>
<li>Videos</li>
</ul>
</nav>
</header>
Once you fix the position you have to specify where you want it.
top: 20px;
left: 0px;
Etc....
You have to add a width to fixed elements (100% in this case):
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html,
body {
width: 100%;
height: 100%;
}
header nav #logo {
width: 140px;
position: absolute;
top: 15px;
}
nav {
position: fixed;
width: 100%;
background-color: #242628;
height: 70px;
padding-left: 20px;
}
nav ul {
position: absolute;
height: 100%;
margin: auto;
top: 0;
bottom: 0;
width: 600px;
padding-left: 200px;
}
nav ul li {
-moz-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
display: inline;
float: left;
height: inherit;
width: 100px;
border-right: 1px solid gray;
}
nav ul li:hover {
background-color: rgba(12, 240, 255, 0.3);
}
nav ul li a {
color: white;
text-decoration: none;
position: absolute;
height: inherit;
width: inherit;
text-align: center;
padding-top: 25px;
}
<header>
<nav>
<img id="logo" src="images/logo.png" alt="logo" />
<ul>
<li>Home</li>
<li>Rate it!</li>
<li>Courses</li>
<li>Videos</li>
</ul>
</nav>
</header>
I let you here a working version. I only replaced relative with fixed in your code to the nav
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html,
body {
width: 100%;
height: 300%;
}
header nav #logo {
width: 140px;
position: absolute;
top: 15px;
}
nav {
position: fixed;
background-color: #242628;
height: 70px;
padding-left: 20px;
}
nav ul {
position: absolute;
height: 100%;
margin: auto;
top: 0;
bottom: 0;
width: 600px;
padding-left: 200px;
}
nav ul li {
-moz-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
display: inline;
float: left;
height: inherit;
width: 100px;
border-right: 1px solid gray;
}
nav ul li:hover {
background-color: rgba(12, 240, 255, 0.3);
}
nav ul li a {
color: white;
text-decoration: none;
position: absolute;
height: inherit;
width: inherit;
text-align: center;
padding-top: 25px;
}
<header>
<nav>
<img id="logo" src="images/logo.png" alt="logo" />
<ul>
<li>Home</li>
<li>Rate it!</li>
<li>Courses</li>
<li>Videos</li>
</ul>
</nav>
</header>
Note that I set height to 300% to have some scroll on the document
I honestly don't see anything wrong:
http://codepen.io/anon/pen/BWpLdd
.scrollTest {
height: 2000px;
background: -moz-linear-gradient(top, #a90329 0%, #8f0222 44%, #6d0019 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #a90329 0%,#8f0222 44%,#6d0019 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #a90329 0%,#8f0222 44%,#6d0019 100%);
}
* {
box-sizing: border-box;
padding: 0;
margin: 0; }
html, body {
width: 100%;
height: 100%; }
header nav #logo {
width: 140px;
position: absolute;
top: 15px; }
nav {
position: fixed;
background-color: #242628;
height: 70px;
padding-left: 20px;
width: 100%;
}
nav ul {
position: absolute;
height: 100%;
margin: auto;
top: 0;
bottom: 0;
width: 800px;
padding-left: 200px; }
nav ul li {
-moz-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
display: inline-block;
height: inherit;
width: 100px;
border-right: 1px solid gray; }
nav ul li:hover {
background-color: rgba(12, 240, 255, 0.3); }
nav ul li a {
color: white;
text-decoration: none;
position: absolute;
height: inherit;
width: inherit;
text-align: center;
padding-top: 25px; }
Make sure you're adding it to the nav parent element.
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html,
body {
width: 100%;
height: 100%;
}
header nav #logo {
width: 140px;
position: absolute;
top: 15px;
}
nav {
position: fixed;
background-color: #242628;
height: 70px;
padding-left: 20px;
width: 100%;
background-color: black;
}
nav ul {
position: relative;
height: 100%;
margin: auto;
top: 0;
bottom: 0;
}
nav ul li {
-moz-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
display: inline;
float: left;
height: inherit;
width: 200px;
border-right: 1px solid gray;
}
nav ul li:hover {
background-color: rgba(12, 240, 255, 0.3);
}
nav ul li a {
color: white;
text-decoration: none;
position: absolute;
height: inherit;
width: inherit;
text-align: center;
padding-top: 25px;
}
article{
height: 500px;
}
<header>
<nav>
<img id="logo" src="" alt="logo" />
<ul>
<li>Home</li>
<li>Rate it!</li>
<li>Courses</li>
<li>Videos</li>
</ul>
</nav>
</header>
<article></article>
Working code
If your nav is set to realtive and is changed to fixed your absolute elements will be relative to the body and those elements will leave the nav.
Change the position of the absolute elements and the css of the nav to:
nav {
background-color: #242628;
height: 70px;
padding-left: 20px; }
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
}
The problem I am having is the formatting of the CSS once the windows resize to smaller. I have been having a lot of trouble, and think that the problem lies in my initial code; I just am not sure where.
I am pretty new to coding and hoping to learn.
.nav-main {
position: absolute;
top: 0;
height: 65px;
width: 100%;
text-align: center;
}
.nav-main ul {
position: relative;
margin: 0 auto;
padding: 0;
list-style: none;
font-size: 22px;
line-height: 100%;
font-family: 'Futura W01 Bold', sans-serif;
text-align: center;
text-transform: uppercase;
display: inline-block;
width: 100%;
}
.nav-top {
position: relative;
margin: 0;
padding: 0 66px 0 50px;
float: none;
display: inline-block;
list-style: none;
}
.nav-top:first-child {
padding-left: 0;
}
.nav-top:last-child {
background-image: none;
padding-right: 0;
}
.nav-top:last-child:after {
content: none;
}
.nav-top > a {
position: relative;
display: block;
margin: 0;
color: #6f6f6f;
text-decoration: none;
padding-top: 20px;
padding-bottom: 5px;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.nav-top a:hover,
.nav-top.active > a {
color: #454545;
border-bottom: 4px solid #00e9d9;
text-decoration: none;
}
.nav-top ul {
display: block;
position: absolute;
left: -8.75px;
width: 105%;
top: calc(100% - 1px);
border-bottom-left-radius: .3em;
border-bottom-right-radius: .3em;
}
.nav-top:hover ul {
position: absolute;
top: calc(100% - 1px);
left: -8.75px;
width: 105%;
}
.nav-top li {
float: center;
background-color: #e9e9e9;
padding-top: 16px;
padding-bottom: 10px;
text-align: inherit;
}
.nav-top li:last-child {
padding-bottom: 16px;
border-bottom-left-radius: .3em;
border-bottom-right-radius: .3em;
}
.nav-top li > a {
position: relative;
display: inline;
margin: 0;
color: #6f6f6f;
text-decoration: none;
padding-top: 20px;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.nav-top:after {
display: block;
position: absolute;
left: 100%;
top: -17px;
width: 22px;
z-index: 1;
transform: translateX(-50%);
height: 100%;
-ms-transform: translateX(-50%);
-webkit-transform: translateX(-50%);
}
#media only screen and (max-width:960px) {
.nav-main ul {
font-size: 18px;
}
.nav-top ul {
font-size: 15px;
}
.nav-main li {
padding: 0 46px 0 30px; /* 0 66 0 50 */
}
.nav-top li {
padding-top: 11px;
text-align: center;/* top 16 bottom 10*/
float: center;
}
<nav class="nav-main" role="navigation">
<ul>
<li class="nav-top">Welcome</li>
<li class="nav-top">About
<ul class="drop-down">
<li class="nav-drop">Services</li>
<li class="nav-drop">Clients</li>
<li class="nav-drop">Press</li>
<li class="nav-drop">Leadership</li>
<li class="nav-drop">Follow Us</li>
</ul>
</li>
<li class="nav-top">Contact</li>
</ul>
<span class="nav-arrow"></span>
</nav>
JSFIDDLEJS fiddle
Your .nav-main li on #media only screen and (max-width:960px) is affecting it.
You could either use the :not selector .nav-main li:not(.nav-drop) or overwrite the .nav-drop with padding-left: 0; padding-right: 0.
Don't forget to revise it in case you use other media queries.
JSFiddle
as i explained everything in title then i will just provide you guys with code i have for now, i've been trying to reach what i want for so long but no luck....
It is acting like responsive but i want to keep it in place even it's resized...
Screenshot
<!DOCTYPE html>
<html>
<head>
<title>
Home
</title>
<style>
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
margin: 0 0 0 0;
font-size: 13px;
text-align: center;
}
#content1{
//float: left;
width: 300px;
height: 740px;
margin-left: 50px;
}
#content2{
//float: right;
margin-right: 50px;
width: 300px;
height: 300px;
}
#content3{
width: 740px;
height: 740px;
}
.content{
margin: 20px 100px auto auto;
display: inline-block;
background-color: #F0F0F0;
}
#navbar{
margin: 10px auto auto auto;
min-width: 120px;
min-height: 120px;
}
#navbar-menu{
}
#navbar-menu ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
#navbar-menu ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#navbar-menu ul li:hover {
background: #555;
color: #fff;
}
#navbar-menu ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
#navbar-menu ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
#navbar-menu ul li ul li:hover { background: #666; }
#navbar-menu ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
#navbar-menu ul li.active {
background: #555;
color: #fff;
}
</style>
</head>
<body background="../images/bg.png">
<div id="navbar">
<div id="navbar-menu">
<ul><li class="active">Home</li>
<li>About</li>
<li>
Projects
<ul>
<li>Web Design</li>
<li>Web Development</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
</div>
<div id="content1" class="content">
<h1>ey</h1>
</div>
<div id="content2" class="content">
<h2>eye</h2>
</div>
<div id="content3" class="content">
<h3>eyey</h3>
</div>
</body>
</html>
I have modified some of your CSS code:
CSS : Updated
#content1{
width: 20%;
height: 740px;
}
#content2{
width: 20%;
height: 300px;
}
#content3{
width: 40%;
height: 740px;
}
.content{
margin-top:20px;
margin-left:5%;
display: inline-block;
float:left;
background-color: #F0F0F0;
}
Replace the above code to your Style.
I believe your looking for a media Query. Such as
#media (min width: 540px) {
"div you want to adjust {
"property you want to affect"
}
}
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries
I have a horizontal list in which i am placing div's which are hidden until hovered over. To keep the dimensions (the hidden divs are the width of the menu) i am using outline: 2px solid black; , this works in ie and chrome, it outlines the li item but in firefox it outlines the entire ul item including the hidden div.
Does anyone know of a workaround for this or do i have a conflict for firefox outline?
css:
#marketmenu ul li{
display: block;
float: left;
position: relative;
cursor: pointer !important;
z-index: inherit;
font-size: 16px;
padding-top: 2px;
font-weight: bolder;
width: 15%;
height: 40px;
text-align: center;
background: white;
outline: 2px solid black;
}
#marketmenu ul li div {
position: absolute;
display: block;
top: 98%;
width: 600%;
background: #ffffff;
height: 200px;
opacity: 0;
visibility: hidden;
overflow: hidden;
z-index: 9;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
border-radius: 0 0 3px 3px;
-webkit-transition: all .3s ease .15s;
-moz-transition: all .3s ease .15s;
-o-transition: all .3s ease .15s;
-ms-transition: all .3s ease .15s;
transition: all .3s ease .15s;
}
html:
<div class="mheader-container">
<div id="logo" class="clearfix">
<img src="...">
</div>
<div class="userstatus">
<span class="icon-user-add"></span> Create an account
<span class="icon-user"></span> Log in
</div>
</div>
<div id="market_navigation" class="market_navigation clearfix">
<div id="marketmenu">
<ul>
<li>one<div class="menudrop"></div></li>
<li>two<div class="menudrop"></div></li>
<li>three<div class="menudrop"></div></li>
<li>four<div class="menudrop"></div></li>
<li>five<div class="menudrop"></div></li>
<li>six<div class="menudrop"></div></li>
</ul>
</div>
</div>
jsfiddle (remember its only in firefox there is a issue, renders fine in ie/chrome)
http://jsfiddle.net/ww2rkexd/1/
On the last li item, add a class of "last":
<ul>
<li>one<div class="menudrop"></div></li>
<li>two<div class="menudrop"></div></li>
<li>three<div class="menudrop"></div></li>
<li>four<div class="menudrop"></div></li>
<li>five<div class="menudrop"></div></li>
<li class="last">six<div class="menudrop"></div></li>
</ul>
Then change the CSS for the menudrop class from outline to border:
#marketmenu ul li{
display: block;
float: left;
position: relative;
cursor: pointer !important;
z-index: inherit;
font-size: 16px;
padding-top: 2px;
font-weight: bolder;
width: 15%;
height: 40px;
text-align: center;
background: white;
border-left: 2px solid black;
border-top: 2px solid black;
border-bottom: 2px solid black;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
And add the following CSS for the "last" class
li.last{
border-right: 2px solid black;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
ok this isnt pretty but it works....basically set a background of the border color and then a overlay div with the correct color. The dropdown div remains in proportion to the parent menu.
jsfiddle:
http://jsfiddle.net/dheffernan/pas1fqcp/
HTML
<div id="market_navigation" class="market_navigation clearfix">
<div id="marketmenu">
<ul>
<li><span class="innerli leftish">1st<div class="menudrop"></div></span></li>
<li><span class="innerli">2nd<div class="menudrop"></div></span></li>
<li><span class="innerli">3rd<div class="menudrop"></div></span></li>
<li><span class="innerli">4th<div class="menudrop"></div></span></li>
<li><span class="innerli">5th<div class="menudrop"></div></span></li>
<li><span class="innerli rightish">6th<div class="menudrop last"></div></span></li>
</ul>
</div>
</div>
css
#marketmenu ul{
cursor: pointer;
}
#marketmenu ul li{
display: block;
float: left;
position: relative;
cursor: pointer !important;
z-index: inherit;
font-size: 16px;
padding-top: 2px;
font-weight: bolder;
width: 15%;
height: 40px;
text-align: center;
background: black;
/*
outline: 2px solid black;
*/
}
.innerli{
display: block;
overflow: auto;
height: 88%;
width: 98%;
margin: 1%;
margin-left: 2%;
background-color: white;
padding-top: 6%;
}
.leftish{
margin-left: 2.5%;
}
.rightish{
width: 96%;
}
#marketmenu ul li div {
position: absolute;
display: block;
top: 98%;
width: 596.5%;
background: #ffffff;
height: 200px;
opacity: 0;
background: black;
visibility: hidden;
overflow: hidden;
z-index: 9;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
border-radius: 0 0 3px 3px;
-webkit-transition: all .3s ease .15s;
-moz-transition: all .3s ease .15s;
-o-transition: all .3s ease .15s;
-ms-transition: all .3s ease .15s;
transition: all .3s ease .15s;
}
#marketmenu ul li:first-child div {
}
#marketmenu ul li:nth-child(2) div {
margin-left: -100%;
}
#marketmenu ul li:nth-child(3) div {
margin-left: -200%;
}
#marketmenu ul li:nth-child(4) div {
margin-left: -300%;
}
#marketmenu ul li:nth-child(5) div {
margin-left: -400%;
}
#marketmenu ul li:nth-child(6) div {
margin-left: -500%;
padding-top: 2px;
}
#marketmenu ul li:hover div {
opacity: 1;
visibility: visible;
overflow: visible;
}
.market_navigation{
position: relative;
z-index: 40;
width: 70%;
margin-left: 30%;
height: 40px;
background: white;
}