I am developing a multiline menu in bootstrap and I have used a bootstrap css class “nav-justified” for width equality of every menu. The class “nav-justified” is working very well for equal width. But I need another option that is equal height, maintain height equality for every menu in that section. I added my problem with graphically in below:
nav.navbar {
width: 100%;
border: none;
margin: 0;
padding: 0;
background: #adadad;
border-bottom: 1px solid #8e8e8e
/*#8e8e8e*/
;
}
nav.navbar-fixed-top {
height: 150px;
position: fixed;
margin-left: 5px;
margin-right: 5px;
top: 26px;
bottom: 0;
right: 0;
left: 0;
float: none;
padding: 5px 5px 0px 5px;
background: #adadad;
/*mask-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #202020 25%, #202020 75%, rgba(255, 255, 255, 0) 100%);*/
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
}
nav .container-fluid {
padding-right: 0px;
padding-left: 0px;
height: 100%;
}
.navbar-header .navbar-toggle .icon-bar {
background-color: black;
}
ul.top-menu {
/*width: 100%;*/
border: none;
margin: 0px 0px 0px 0px;
padding: 0;
/*height: 44px;*/
border-bottom: 1px solid #bbbbbb;
border-radius: 6px;
background: #5c5a5a;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#5c5a5a), to(#3d3b3b));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #3d3b3b, #5c5a5a);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #3d3b3b, #5c5a5a);
/* IE 10 */
background: -ms-linear-gradient(top, #3d3b3b, #5c5a5a);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #3d3b3b, #5c5a5a);
vertical-align: middle;
background: #353535;
/* Old browsers */
background: -moz-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #353535), color-stop(50%, #5c5a5a), color-stop(100%, #303030));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%);
/* IE10+ */
background: linear-gradient(to bottom, #353535 0%, #5c5a5a 50%, #303030 100%);
/* W3C */
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#353535', endColorstr='#303030', GradientType=0);
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
}
ul.top-menu > li.active {
background: #ff0000;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#6f0505), to(#ff0000));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #ff0000, #6f0505);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #ff0000, #6f0505);
/* IE 10 */
background: -ms-linear-gradient(top, #ff0000, #6f0505);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #ff0000, #6f0505);
outline: none;
}
ul.top-menu > li:last-child.active {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
ul.top-menu > li:first-child.active {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
ul.top-menu > li:hover {
cursor: pointer;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0) 100%);
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
}
ul.top-menu > li:last-child:hover {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
ul.top-menu > li:first-child:hover {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
ul.sub-menu {
/*width: 100%;*/
border: none;
margin: 0;
padding: 0;
vertical-align: middle;
}
ul.sub-menu > ul > li {
display: block;
/*width: 100%;*/
border: none;
margin: 0;
padding: 0;
vertical-align: middle;
}
ul.sub-menu > li > ul > li > a {
text-align: left;
vertical-align: middle;
/*height: auto;*/
/*width: 100%;*/
color: #101010;
font-size: 10pt;
white-space: nowrap;
text-transform: capitalize;
text-shadow: 1px 1px 1px rgba(200, 200, 200, 0.9);
}
ul.sub-menu > li > ul > li > a:hover {
cursor: pointer;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0) 100%);
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
color: #000;
}
ul.dropdown-menu {
margin-top: -2px;
/*position:relative;*/
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
li.dropdown:hover > ul.dropdown-menu {
display: block;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu > .dropdown-menu {
top: 0px;
left: 100%;
margin-top: -1px;
margin-left: -1px;
box-sizing: border-box;
}
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.dropdown-submenu > a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-left-color: #ccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover > a:after {
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left > .dropdown-menu {
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;
-moz-border-radius: 6px 0 6px 6px;
border-radius: 6px 0 6px 6px;
}
.dropdown-menu > ul > ul {
border-radius: 0px;
width: 100%;
}
.dropdown-menu > li > a {
display: block;
padding: 5px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #101010;
font-size: 10pt;
white-space: nowrap;
text-transform: capitalize;
width: 100%;
}
.dropdown-menu > li > a:hover {
background: #ff0000;
}
.dropdown-menu > li {
/*box-shadow:0 1px 1px rgba(0, 0, 0, 0.1);*/
box-sizing: border-box;
border-bottom: 0.5px solid #d5d5d5;
border-top: 0.5px solid #f9f9f9;
border-radius: 0px;
min-width: 260px;
width: 100%;
background: #f2f2f2;
text-align: left;
}
.dropdown-menu > ul > li > a {
box-sizing: border-box;
border-radius: 0px;
width: 100%;
}
.dropdown-toggle > i {
text-align: right;
right: 10px;
position: absolute;
overflow: hidden;
line-height: 1.42857143;
}
.dropdown-menu > li.manage-bar {
background: #bbbbbb;
}
.dropdown-menu > li.manage-bar a {
color: #101010;
}
.dropdown-menu > li.report-bar {
background: #bbbbbb;
}
.dropdown-menu > li.report-bar a {
color: #101010;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-fixed-top" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="btn btn-primary navbar-toggle collapsed" data-toggle="collapse" data-target="#menu-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--<a class="navbar-brand" href="#">Brand</a>-->
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="menu-navbar-collapse-1">
<ul class="nav nav-justified top-menu">
<li class="active">
HOME
</li>
<li>
GARMENTS
</li>
<li>
YARN DYEING
</li>
<li>
KNITTING
</li>
<li>
FABRIC DYEING
</li>
<li>
COMMON MODULES
</li>
<li>
GENERAL SETTING
</li>
</ul>
<ul class="nav nav-justified">
<li>
<ul class="nav nav-justified" style="border: 1px solid #f00">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">ADMIN <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
Action
</li>
<li>
Another action
</li>
<li>
Something else here
</li>
<li>
Separated link
</li>
<li>
One more separated link
</li>
</ul>
</li>
</ul>
<ul class="nav nav-justified" style="border: 1px solid #f00">
<li>
HELP
</li>
</ul>
</li>
<li>
<ul class="nav nav-justified">
<li>
SUPPORT
</li>
</ul>
<ul class="nav nav-justified">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">CHAT <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
Action
</li>
<li>
Another action
</li>
<li>
Something else here
</li>
<li>
Separated link
</li>
<li>
One more separated link
</li>
</ul>
</li>
</ul>
</li>
<li>
<ul class="nav nav-justified">
<li>
NO MENU
</li>
</ul>
<ul class="nav nav-justified">
<li>
NO MENU
</li>
</ul>
</li>
<li>
<ul class="nav nav-justified">
<li>
NO MENU
</li>
</ul>
<ul class="nav nav-justified">
<li>
NO MENU
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
EDIT==================================================
I have fixed this problem in plunker
But another problem is arising bootstrap dropdown popup does not come properly in IE, Like as below
I need this solution, this is working in chrome and mozila, whats the problem of me?
The complete solution is here
HTML CODE
html {
font-size: 10px;
position: relative;
min-height: 100%;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
html, body {
overflow-x: hidden;
height: 100%;
margin: 0;
}
body {
background: #efeff0 /*url('../img/background.jpg') no-repeat*/;
background-size: cover;
background-attachment: fixed;
/*font: 300 16px 'segoe', Helvetica, Arial, sans-serif;*/
background-color: #efeff0;
color: #303030;
font-family: segoe,"Helvetica Neue",Arial,sans-serif;
font-size: 14px;
line-height: 1.42857;
height: 100%;
width: 100%;
position: absolute;
/*border:5px solid #5f5f5f;*/
overflow: hidden;
}
/* Customize the nav-justified links to be fill the entire space of the .navbar */
.navbar-header .navbar-toggle .icon-bar {
background-color: black;
}
.nav-justified > li > a {
color: inherit;
}
.nav-justified > .active > a,
.nav-justified > .active > a:hover,
.nav-justified > .active > a:focus {
background-image: none;
background: none;
-webkit-box-shadow: inset 0 3px 7px rgba(0,0,0,.15);
box-shadow: inset 0 3px 7px rgba(0,0,0,.15);
}
.nav-justified > li:first-child > a {
/*border-radius: 5px 5px 0 0;*/
}
.nav-justified > li:last-child > a {
/*border-bottom: 0;
border-radius: 0 0 5px 5px;*/
}
.nav-justified > li > a:hover {
background: none;
background-image: none;
}
.nav > li > a {
padding: 5px 10px 0px 20px;
}
#media (min-width: 768px) {
/*.nav-justified {
max-height: 52px;
}*/
.nav-justified > li > a {
border-right: 0.5px solid #404040;
border-left: 0.5px solid #353535;
color: #fff;
text-align: left;
}
.nav-justified > li:first-child > a {
border-left: 0;
border-radius: 6px 0 0 6px;
}
.nav-justified > li:last-child > a {
border-right: 0;
border-radius: 0 6px 6px 0;
}
}
.navbar-collapse {
border-top: 0px solid #4b4b4b;
/*padding:0px 5px 0px 5px;*/
}
/*.navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse {
padding: 5px 5px 0px 5px;
}*/
.container > .navbar-header, .container-fluid > .navbar-header, .container > .navbar-collapse, .container-fluid > .navbar-collapse {
margin: 0px 5px 0px 5px;
}
nav.navbar-fixed-top {
height: 150px;
position: fixed;
top: 26px;
bottom: 0;
right: 0;
left: 0;
float: none;
background: #adadad;
/*mask-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #202020 25%, #202020 75%, rgba(255, 255, 255, 0) 100%);*/
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
}
.navbar-fixed-top, .navbar-fixed-bottom {
position: relative;
}
nav .container-fluid {
padding-right: 0px;
padding-left: 0px;
overflow: visible;
}
nav.navbar {
/*display: block;*/
width: 100%;
border: none;
margin: 0;
padding: 0;
background: #adadad;
border-bottom: 1px solid #8e8e8e /*#8e8e8e*/;
}
ul.top-menu {
width: 100%;
border: none;
margin: 5px 0px 0px 0px;
padding: 0;
min-height: 44px;
border-bottom: 1px solid #bbbbbb;
border-radius: 6px;
background: #5c5a5a;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#5c5a5a), to(#3d3b3b));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #3d3b3b, #5c5a5a);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #3d3b3b, #5c5a5a);
/* IE 10 */
background: -ms-linear-gradient(top, #3d3b3b, #5c5a5a);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #3d3b3b, #5c5a5a); /*box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-moz-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-o-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-webkit-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-ms-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);*/
vertical-align: middle;
background: #353535; /* Old browsers */
background: -moz-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #353535), color-stop(50%, #5c5a5a), color-stop(100%, #303030)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #353535 0%, #5c5a5a 50%, #303030 100%); /* IE10+ */
background: linear-gradient(to bottom, #353535 0%, #5c5a5a 50%, #303030 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#353535', endColorstr='#303030', GradientType=0 ); /* IE6-9 */
/*background:url(NEXTIT.CK.GS.WebClient/Content/images/admin-logo.png) #fff;*/
/*mask-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #202020 25%, #202020 75%, rgba(255, 255, 255, 0) 100%);*/
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6); /*background:white;
background:rgba(255,255,255,0.8);*/
/*filter:blur(4px);
-o-filter:blur(4px);
-ms-filter:blur(4px);
-moz-filter:blur(4px);
-webkit-filter:blur(4px);*/
}
ul.top-menu > li > a {
color: #fff;
font-weight: normal;
}
ul.top-menu > li.active {
background: #ff0000;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#6f0505), to(#ff0000));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #ff0000, #6f0505);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #ff0000, #6f0505);
/* IE 10 */
background: -ms-linear-gradient(top, #ff0000, #6f0505);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #ff0000, #6f0505);
outline: none;
}
ul.top-menu > li:last-child.active {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
ul.top-menu > li:first-child.active {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
ul.top-menu > li:hover {
/*background-color: #f00;*/
/*border-radius:6px;*/
/*background:rgba(255, 255, 255, 0.2);*/
cursor: pointer;
/*background: -moz-linear-gradient(top, rgba(0,0,0,0.2) 0%, rgba(255,255,255,0.5) 50%, rgba(0,0,0,0.2) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.2)), color-stop(50%,rgba(255,255,255,0.2)), color-stop(100%,rgba(0,0,0,0.2)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 50%,rgba(0,0,0,0.2) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 50%,rgba(0,0,0,0.2) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 50%,rgba(0,0,0,0.2) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 50%,rgba(0,0,0,0.2) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#33000000', endColorstr='#33000000',GradientType=0 );
-webkit-box-shadow: inset 5px rgba(0,0,0,.2), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 5px rgba(0,0,0,.2), 0 0 8px rgba(102, 175, 233, 0.6);*/
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0) 100%);
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
}
ul.top-menu > li:last-child:hover {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
ul.top-menu > li:first-child:hover {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
ul.sub-menu {
width: 100%;
height: 100px;
border: none;
margin: 0;
padding: 0;
vertical-align: middle;
list-style: none;
display: block; /*box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-moz-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-o-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-webkit-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);
-ms-box-shadow: 2px 2px 2px rgba(0,0,0,0.40);*/
}
ul.sub-menu > li {
height: 100px;
border: none;
margin: 0;
padding: 0;
vertical-align: middle;
list-style: none;
}
ul.sub-menu > li > div {
height: 100%;
display: table;
table-layout: fixed;
border-collapse: collapse;
width: 100%;
}
ul.sub-menu > li > div > ul {
display: table-row;
}
ul.sub-menu > li > div > ul > li {
display: table-cell;
width: 100%;
border: none;
margin: 0;
padding: 0;
vertical-align: middle;
padding-left: 20px;
height: auto;
}
ul.sub-menu > li > div > ul > li > a {
text-align: left;
text-decoration: none;
height: 100%;
line-height: 100%;
display: table;
content: "";
clear: both;
vertical-align: middle;
width: 100%;
color: #101010;
font-size: 10pt;
white-space: nowrap;
text-transform: capitalize;
text-shadow: 1px 1px 1px rgba(200,200,200,0.9);
padding: 0px;
}
ul.sub-menu > li > div > ul > li > a > span {
line-height: 100%;
display: table-cell;
vertical-align: middle;
clear: both;
}
ul.sub-menu > li > div > ul > li > a > span i {
float: right;
margin-right: 14px;
content: "";
clear: both;
/*margin-top: -18px;
right: 10px;
text-align: right;*/
}
ul.sub-menu > li > div > ul > li > a:hover {
background: none;
}
ul.sub-menu > li > div > ul > li:hover {
cursor: pointer;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0) 100%);
/*-webkit-box-shadow:0px 1px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow:0px 1px 1px rgba(0, 0, 0, 0.1);
box-shadow:0px 1px 1px rgba(0, 0, 0, 0.1);*/
box-shadow: 0 0 25px rgba(0, 0, 0, 0.1), inset 0 0 1px rgba(255, 255, 255, 0.6);
color: #000;
}
/*ul.sub-menu > li > div > ul > li.dropdown > ul.dropdown-menu {
top: 100%;
}*/
ul.dropdown-menu {
width: 100%;
margin: 0;
padding: 0;
}
li.dropdown:hover > ul.dropdown-menu {
display: block;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu > .dropdown-menu {
top: 0px;
left: 100%;
margin-top: -2px;
margin-left: -1px;
/*-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px;
border-radius: 0 6px 6px 6px;*/
/*box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);*/
box-sizing: border-box;
}
.dropdown-submenu > .dropToLeft {
left: auto;
right: 100%;
top: 0px;
/*position:relative;*/
}
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.dropdown-submenu > a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-left-color: #ccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover > a:after {
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left > .dropdown-menu {
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;
-moz-border-radius: 6px 0 6px 6px;
border-radius: 6px 0 6px 6px;
}
.dropdown-menu > ul > ul {
border-radius: 0px;
width: 100%;
}
.dropdown-menu > li > a {
display: block;
padding: 5px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #101010;
font-size: 10pt;
white-space: nowrap;
text-transform: capitalize;
width: 100%;
}
.dropdown-menu > li > a:hover {
background: #ff0000;
}
.dropdown-menu > li:hover {
background: #ff0000;
}
.dropdown-menu > li {
/*box-shadow:0 1px 1px rgba(0, 0, 0, 0.1);*/
box-sizing: border-box;
border-bottom: 0.5px solid #d5d5d5;
border-top: 0.5px solid #f9f9f9;
border-radius: 0px;
width: 100%;
background: #f2f2f2;
text-align: left;
}
.dropdown-menu > ul > li > a {
/*box-shadow:0 1px 1px rgba(0, 0, 0, 0.1);*/
box-sizing: border-box;
/*border-bottom:1px solid rgba(0,0,0,0.40);
border-top:1px solid #ccc;*/
border-radius: 0px;
width: 100%;
}
.dropdown-toggle > i {
text-align: right;
right: 10px;
position: absolute;
overflow: hidden;
line-height: 1.42857143;
}
.dropdown-menu > li.manage-bar {
background: #bbbbbb;
}
.dropdown-menu > li.manage-bar a {
color: #101010;
}
.dropdown-menu > li.report-bar {
background: #bbbbbb;
}
.dropdown-menu > li.report-bar a {
color: #101010;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<script data-require="jquery#*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link data-require="bootstrap#*" data-semver="3.2.0" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css" />
<script data-require="bootstrap#*" data-semver="3.2.0" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<nav class="navbar navbar-fixed-top" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#menu-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--<a class="navbar-brand" href="#">Brand</a>-->
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="menu-navbar-collapse-1">
<ul class="top-menu nav nav-justified">
<li class="active">HOME</li>
<li>GARMENTS</li>
<li>YARN DYEING</li>
<li>KNITTING</li>
<li>FABRIC DYEING</li>
<li>COMMON MODULES</li>
<li>GENERAL SETTING</li>
</ul>
<ul class="sub-menu nav nav-justified">
<li>
<div>
<ul>
<li class="dropdown"><span>ADMIN <span class="caret"></span></span>
<ul class="dropdown-menu" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li>Separated link</li>
<li class="dropdown-submenu"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Manage
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li><span>HELP</span></li>
</ul>
</div>
</li>
<li>
<div>
<ul>
<li><span>HELP</span></li>
</ul>
<ul>
<li class="dropdown"><span>CHAT<span class="caret"></span></span>
<ul class="dropdown-menu" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
<li class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div>
</li>
<li>
<div>
<ul>
<li><span>NO MENU</span></li>
</ul>
<ul>
<li><span>NO MENU</span></li>
</ul>
</div>
</li>
<li>
<div>
<ul>
<li><span>NO MENU</span></li>
</ul>
<ul>
<li class="dropdown"><span>ADMIN<span class="caret"></span></span>
<ul class="dropdown-menu" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li>Separated link</li>
<li class="dropdown-submenu ">Manage <span class="caret"></span>
<ul class="dropdown-menu dropToLeft" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</body>
</html>
Related
I am having trouble with this navbar: https://jsfiddle.net/d6a7b3Ly/1/
1- With many links in the bar, the on-hover effect makes the other below links to move to the sides, but I am not sure which padding effect is doing that and how to fix it.
When changing border-top to 0px it fixes the issue, but makes the submenus not working:
#nav .current a, #nav li:hover > a {
background: #d1d1d1; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb', endColorstr='#a1a1a1'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#a1a1a1)); /* for webkit browsers */
background: -moz-linear-gradient(top, #ebebeb, #a1a1a1); /* for firefox 3.6+ */
color: #444;
border-top: solid 1px #f8f8f8;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
2- I am trying to make a right to left option of the menu. and I changed float: right; under #nav li { in the csss, and added the whole html in a <div dir="RTL">, but the level 2 submenus are still opening facing left, and they should be right. I tested some changes in the css but none worked for that.
Here is a link to the rtl navbar: https://jsfiddle.net/ct8kp6eo/1/
And this is the floating change in the CSS:
#nav li {
margin: 0 5px;
padding: 0 0 8px;
float: right;
position: relative;
list-style: none;
}
To solve issue add padding-top: 7px to adjust for the border-top spoiling the layout to #nav ul li:hover a, #nav li:hover li a.
You have overlapping labels and to solve that adjust the z-index property of the #nav li:hover > ul to 1.
body {
font: normal .8em/1.5em Arial, Helvetica, sans-serif;
background: #ebebeb;
width: 900px;
margin: 100px auto;
color: #666;
}
a {
color: #333;
}
#nav {
margin: 0;
padding: 7px 6px 0;
line-height: 100%;
border-radius: 2em;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
background: #8b8b8b; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a9a9a9', endColorstr='#7a7a7a'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#a9a9a9), to(#7a7a7a)); /* for webkit browsers */
background: -moz-linear-gradient(top, #a9a9a9, #7a7a7a); /* for firefox 3.6+ */
border: solid 1px #6d6d6d;
}
#nav li {
margin: 0 5px;
padding: 0 0 8px;
float: left;
position: relative;
list-style: none;
}
/* main level link */
#nav a {
font-weight: bold;
color: #e7e5e5;
text-decoration: none;
display: block;
padding: 8px 20px;
margin: 0;
-webkit-border-radius: 1.6em;
-moz-border-radius: 1.6em;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}
/* main level link hover */
#nav .current a, #nav li:hover > a {
background: #d1d1d1; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb', endColorstr='#a1a1a1'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#a1a1a1)); /* for webkit browsers */
background: -moz-linear-gradient(top, #ebebeb, #a1a1a1); /* for firefox 3.6+ */
color: #444;
border-top: solid 1px #f8f8f8;
padding-top: 7px; /* ADDED */
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
/* sub levels link hover */
#nav ul li:hover a, #nav li:hover li a {
background: none;
border: none;
color: #666;
-webkit-box-shadow: none;
-moz-box-shadow: none;
}
#nav ul a:hover {
background: #0399d4 !important; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#04acec', endColorstr='#0186ba'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba)) !important; /* for webkit browsers */
background: -moz-linear-gradient(top, #04acec, #0186ba) !important; /* for firefox 3.6+ */
color: #fff !important;
-webkit-border-radius: 0;
-moz-border-radius: 0;
text-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
/* level 2 list */
#nav ul {
background: #ddd; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#cfcfcf'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#cfcfcf)); /* for webkit browsers */
background: -moz-linear-gradient(top, #fff, #cfcfcf); /* for firefox 3.6+ */
display: none;
margin: 0;
padding: 0;
width: 185px;
position: absolute;
top: 35px;
left: 0;
border: solid 1px #b4b4b4;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
/* dropdown */
#nav li:hover > ul {
display: block;
z-index: 1; /* ADDED */
}
#nav ul li {
float: none;
margin: 0;
padding: 0;
}
#nav ul a {
font-weight: normal;
text-shadow: 0 1px 1px rgba(255, 255, 255, .9);
}
/* level 3+ list */
#nav ul ul {
left: 181px;
top: -3px;
}
/* rounded corners for first and last child */
#nav ul li:first-child > a {
-webkit-border-top-left-radius: 9px;
-moz-border-radius-topleft: 9px;
-webkit-border-top-right-radius: 9px;
-moz-border-radius-topright: 9px;
}
#nav ul li:last-child > a {
-webkit-border-bottom-left-radius: 9px;
-moz-border-radius-bottomleft: 9px;
-webkit-border-bottom-right-radius: 9px;
-moz-border-radius-bottomright: 9px;
}
/* clearfix */
#nav:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
#nav {
display: inline-block;
}
html[xmlns] #nav {
display: block;
}
* html #nav {
height: 1%;
}
<ul id="nav">
<li class="current">Home</li>
<li>My Projects
<ul>
<li>N.Design Studio
<ul>
<li>Portfolio</li>
<li>WordPress Themes</li>
<li>Wallpapers</li>
<li>Illustrator Tutorials</li>
</ul>
</li>
<li>Web Designer Wall
<ul>
<li>Design Job Wall</li>
</ul>
</li>
<li>IconDock</li>
<li>Best Web Gallery</li>
</ul>
</li>
<li>Multi-Levels
<ul>
<li>Team
<ul>
<li>Sub-Level Item</li>
<li>Sub-Level Item
<ul>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
</ul>
</li>
<li>Sub-Level Item</li>
</ul>
</li>
<li>Sales</li>
<li>Another Link</li>
<li>Department
<ul>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
</ul>
</li>
</ul>
</li>
<li>About</li>
<li>Contact Us</li>
<li>Contact Us</li>
<li>Contact Us</li>
<li>Contact Us</li>
<li>Contact Us</li>
<li>Contact Us</li>
<li>Contact Us</li>
<li>Contact Us</li>
</ul>
To solve the second issue, add transform: translateX(-100%); to the #nav ul ul rule instead of the left value - see demo below:
body {
font: normal .8em/1.5em Arial, Helvetica, sans-serif;
background: #ebebeb;
margin: 100px auto;
color: #666;
}
a {
color: #333;
}
#nav {
margin: 0;
padding: 7px 6px 0;
line-height: 100%;
border-radius: 2em;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
background: #8b8b8b; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a9a9a9', endColorstr='#7a7a7a'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#a9a9a9), to(#7a7a7a)); /* for webkit browsers */
background: -moz-linear-gradient(top, #a9a9a9, #7a7a7a); /* for firefox 3.6+ */
border: solid 1px #6d6d6d;
}
#nav li {
margin: 0 5px;
padding: 0 0 8px;
float: right;
position: relative;
list-style: none;
}
/* main level link */
#nav a {
font-weight: bold;
color: #e7e5e5;
text-decoration: none;
display: block;
padding: 8px 4px;
margin: 0;
-webkit-border-radius: 1.6em;
-moz-border-radius: 1.6em;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}
/* main level link hover */
#nav .current a, #nav li:hover > a {
background: #d1d1d1; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb', endColorstr='#a1a1a1'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#a1a1a1)); /* for webkit browsers */
background: -moz-linear-gradient(top, #ebebeb, #a1a1a1); /* for firefox 3.6+ */
color: #444;
border-top: solid 1px #f8f8f8;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
/* sub levels link hover */
#nav ul li:hover a, #nav li:hover li a {
background: none;
border: none;
color: #666;
-webkit-box-shadow: none;
-moz-box-shadow: none;
}
#nav ul a:hover {
background: #0399d4 !important; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#04acec', endColorstr='#0186ba'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba)) !important; /* for webkit browsers */
background: -moz-linear-gradient(top, #04acec, #0186ba) !important; /* for firefox 3.6+ */
color: #fff !important;
-webkit-border-radius: 0;
-moz-border-radius: 0;
text-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
/* level 2 list */
#nav ul {
background: #ddd; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#cfcfcf'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#cfcfcf)); /* for webkit browsers */
background: -moz-linear-gradient(top, #fff, #cfcfcf); /* for firefox 3.6+ */
display: none;
margin: 0;
padding: 0;
width: 185px;
position: absolute;
top: 35px;
left: 10px
border: solid 1px #b4b4b4;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
/* dropdown */
#nav li:hover > ul {
display: block;
}
#nav ul li {
float: none;
margin: 0;
padding: 0;
}
#nav ul a {
font-weight: normal;
text-shadow: 0 1px 1px rgba(255, 255, 255, .9);
}
/* level 3+ list */
#nav ul ul {
/*left: 181px;*/
top: -3px;
transform: translateX(-100%);
}
/* rounded corners for first and last child */
#nav ul li:first-child > a {
-webkit-border-top-left-radius: 9px;
-moz-border-radius-topleft: 9px;
-webkit-border-top-right-radius: 9px;
-moz-border-radius-topright: 9px;
}
#nav ul li:last-child > a {
-webkit-border-bottom-left-radius: 9px;
-moz-border-radius-bottomleft: 9px;
-webkit-border-bottom-right-radius: 9px;
-moz-border-radius-bottomright: 9px;
}
/* clearfix */
#nav:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
#nav {
display: inline-block;
}
html[xmlns] #nav {
display: block;
}
* html #nav {
height: 1%;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "#">
<body>
<div dir="RTL">
<ul id="nav" >
<li class="current" >Home</li>
<li>test
<ul>
<li>test >
<ul>
<li>test 2</li>
<li>test 3</li>
<li>test test test test test 4</li>
<li>test 555 Tutorials</li>
</ul>
<li>test
<ul>
<li>Design Job Wall</li>
</ul>
</li>
<li>IconDock</li>
<li>Best Web Gallery</li>
</ul>
</li>
<li>Multi-Levels
<ul>
<li>Team
<ul>
<li>Sub-Level Item</li>
<li>Sub-Level Item
<ul>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
</ul>
</li>
<li>Sub-Level Item</li>
</ul>
</li>
<li>Sales</li>
<li>Another Link</li>
<li>Department
<ul>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
<li>Sub-Level Item</li>
</ul>
</li>
</ul>
</li>
<li>About</li>
<li>Contact Us</li>
</ul>
</div>
You are adding a border-top solid 1px on hover. Change it to 0px on hover and it will work fine.
#nav .current a, #nav li:hover > a {
background: #d1d1d1; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb', endColorstr='#a1a1a1'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#a1a1a1)); /* for webkit browsers */
background: -moz-linear-gradient(top, #ebebeb, #a1a1a1); /* for firefox 3.6+ */
color: #444;
/*border-top: solid 1px #f8f8f8;*/
border-top: solid 0px #f8f8f8;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
adding 1px top on the hover just gets too much, which makes your items move
I am building a joomla template using built in bootstrap version 2.3.2. The problem is i have long navbar when it comes on tablets, it divide in two lines i would like to have it collapse at 1200px. I am using following code for navigation.
<?php
defined('_JEXEC') or die;
// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');
// Load optional rtl Bootstrap css and Bootstrap bugfixes
JHtmlBootstrap::loadCss($includeMaincss = true);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<jdoc:include type="head" />
<!--[if lt IE 9]>
<script src="<?php echo $this->baseurl ?>/media/jui/js/html5.js"></script>
<![endif]-->
<link href="templates/test/css/template.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<div class="row-fluid">
<div id="logo" class="span12"><img src="templates/test/images/logo.png" alt="Home - Freeterm Limited, London"></div>
</div>
</div>
<div class="container">
<div class="row-fluid">
<nav class="span12 navbar">
<div class="navbar-inner">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse"><jdoc:include type="modules" name="nav" style="none" /></div>
</div>
</nav>
</div></div>
The CSS is as below:
.navbar {
margin: 0px;
}
.navbar-inner {
min-height: 40px;
padding-left: 0px;
padding-right: 0px;
background-color: #363f45;
background-image: -moz-linear-gradient(top, #363f45, #363f45);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#363f45), to(#363f45));
background-image: -webkit-linear-gradient(top, #363f45, #363f45);
background-image: -o-linear-gradient(top, #363f45, #363f45);
background-image: linear-gradient(to bottom, #363f45, #363f45);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff363f45', endColorstr='#ff363f45', GradientType=0);
border: 0px solid #d4d4d4;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: 0 0px 0px rgba(0, 0, 0, 0.065);
-moz-box-shadow: 0 0px 0px rgba(0, 0, 0, 0.065);
box-shadow: 0 0px 0px rgba(0, 0, 0, 0.065);
}
/* ----- Main Menu Styling ----- */
.navbar .nav > li > a {
font-family: 'helvetica', sans-serif;
color: #fff;
text-shadow: none;
line-height: 80px;
padding: 0 30px 0 30px;
border-left: 1px solid #21262b;
}
.navbar .nav > li > a:focus,
.navbar .nav > li > a:hover {
color: #fff;
background-color: #8dbf41;
}
.navbar .nav > .active > a,
.navbar .nav > .active > a:hover,
.navbar .nav > .active > a:focus {
color: #fff;
background-color: #8dbf41;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.navbar .nav li.item-101 a {
border-left: none;
}
/*----- Drop Menu -----*/
nav .nav-child {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 0px 0;
margin: 0;
list-style: none;
background-color: #363f45;
border: 0px solid #ccc;
border: 0px solid rgba(0,0,0,0.2);
*border-right-width: 0px;
*border-bottom-width: 0px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: 0 0px 0px rgba(0,0,0,0);
-moz-box-shadow: 0 px 0px rgba(0,0,0,0);
box-shadow: 0 px 0px rgba(0,0,0,0);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
nav .nav-child.pull-right {
right: 0;
left: auto;
}
nav .nav-child .divider {
*width: 100%;
height: 1px;
margin: 8px 1px;
*margin: -5px 0 5px;
overflow: hidden;
background-color: #e5e5e5;
border-bottom: 1px solid #fff;
}
nav .nav-child a {
display: block;
padding: 0px 20px;
clear: both;
font-size: 13px;
font-family: 'helvetica', sans-serif;
text-transform: uppercase;
height: 50px;
line-height: 50px;
color: #fff;
border: none;
white-space: nowrap;
}
nav .nav > li {
position: relative;
}
nav .nav > li:hover > .nav-child,
nav .nav > li > a:focus + .nav-child {
display: block;
}
nav .nav-child li > a:hover,
nav .nav-child li > a:focus,
nav .nav-child:hover > a {
text-decoration: none;
color: #fff;
background-color: #8dbf41;
}
/*----- Nav Bar Button -----*/
.navbar .btn-navbar {
float: right;
padding: 10px 10px;
margin: 20px;
margin-left: 5px;
color: #ffffff;
text-shadow: 0 0px 0 rgba(0, 0, 0, 0);
background-color: #363f45;
*background-color: #363f45;
background-image: -moz-linear-gradient(top, #363f45, #363f45);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#363f45), to(#363f45));
background-image: -webkit-linear-gradient(top, #363f45, #363f45);
background-image: -o-linear-gradient(top, #363f45, #363f45);
background-image: linear-gradient(to bottom, #363f45, #363f45);
background-repeat: repeat-x;
border-color: #363f45 #363f45 #363f45;
border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff363f45', endColorstr='#ff363f45', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-box-shadow: inset 0 0px 0 rgba(255, 255, 255, 0), 0 0px 0 rgba(255, 255, 255, 0);
-moz-box-shadow: inset 0 0px 0 rgba(255, 255, 255, 0), 0 0px 0 rgba(255, 255, 255, 0);
box-shadow: inset 0 0px 0 rgba(255, 255, 255, 0), 0 0px 0 rgba(255, 255, 255, 0);
}
.navbar .btn-navbar:hover,
.navbar .btn-navbar:focus,
.navbar .btn-navbar:active,
.navbar .btn-navbar.active,
.navbar .btn-navbar.disabled,
.navbar .btn-navbar[disabled] {
color: #ffffff;
background-color: #363f45;
*background-color: #363f45;
}
just add this in your css file
#media (max-width: 1000px) {
.navbar-header {
float: none !important;
}
.navbar-default {
background-color: #222 !important;
border-color: transparent;
padding:0px !important;
}
.nav > li {
display: block !important;
position: relative;
}
.navbar-left, .navbar-right {
float: none !important;
}
.navbar-nav > li.navbar-right {
float: none !important;
}
.navbar{
min-height:50px;
position:relative;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block !important;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none !important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none !important;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
I'm using this:
jsfiddle.net/wromLbq5
And am hoping to have the ability to have multiple accordion sections open at once, and on page load. By this I mean, when one opens, I don't want the other to close. Is this possible? Without javascript as well.
(Ignore all the sub accordions too- I only need one layer)
HTML
<ul class="accordion">
<li id="one" class="files">
My Files<span>495</span>
<ul class="sub-menu">
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>02</em>Skydrive<span>87</span></li>
<li><em>03</em>FTP Server<span>366</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
</ul>
</li>
<li id="two" class="mail">
Mail<span>26</span>
<ul class="sub-menu">
<li><em>01</em>Hotmail<span>9</span></li>
<li><em>02</em>Yahoo<span>14</span></li>
<li><em>03</em>Gmail<span>3</span></li>
</ul>
</li>
<li id="three" class="cloud">
Cloud<span>58</span>
<ul class="sub-menu">
<li><em>01</em>Connect<span>12</span></li>
<li><em>02</em>Profiles<span>19</span></li>
<li><em>03</em>Options<span>27</span></li>
</ul>
</li>
<li id="four" class="sign">
Sign Out
<ul class="sub-menu">
<li><em>01</em>Log Out</li>
<li><em>02</em>Delete Account</li>
<li><em>03</em>Freeze Account</li>
</ul>
</li>
</ul>
CSS
body {margin:50px;}
/* Reset */
.accordion,
.accordion ul,
.accordion li,
.accordion a,
.accordion span {
margin: 0;
padding: 0;
border: none;
outline: none;
}
.accordion li {
list-style: none;
}
/* Layout & Style */
.accordion li > a {
display: block;
position: relative;
min-width: 110px;
padding: 0 10px 0 40px;
height: 32px;
color: #fdfdfd;
font: bold 12px/32px Arial, sans-serif;
text-decoration: none;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #6c6e74;
background: -moz-linear-gradient(top, #6c6e74 0%, #4b4d51 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6c6e74), color-stop(100%,#4b4d51));
background: -webkit-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -o-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -ms-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.accordion > li:hover > a,
.accordion > li:target > a {
color: #3e5706;
text-shadow: 1px 1px 1px rgba(255,255,255, .2);
/*background: url(../img/active.png) repeat-x;*/
background: #a5cd4e;
background: -moz-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a5cd4e), color-stop(100%,#6b8f1a));
background: -webkit-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -o-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -ms-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
}
.accordion li > a span {
display: block;
position: absolute;
top: 7px;
right: 0;
padding: 0 10px;
margin-right: 10px;
font: normal bold 12px/18px Arial, sans-serif;
background: #404247;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
-moz-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
}
.accordion > li:hover > a span,
.accordion > li:target > a span {
color: #fdfdfd;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #3e5706;
}
/* Images */
.accordion > li > a:before {
position: absolute;
top: 0;
left: 0;
content: '';
width: 24px;
height: 24px;
margin: 4px 8px;
background-repeat: no-repeat;
background-image: url(http://designmodo.com/demo/css3accordionmenu/img/icons.png);
background-position: 0px 0px;
}
.accordion li.files > a:before { background-position: 0px 0px; }
.accordion li.files:hover > a:before,
.accordion li.files:target > a:before { background-position: 0px -24px; }
.accordion li.mail > a:before { background-position: -24px 0px; }
.accordion li.mail:hover > a:before,
.accordion li.mail:target > a:before { background-position: -24px -24px; }
.accordion li.cloud > a:before { background-position: -48px 0px; }
.accordion li.cloud:hover > a:before,
.accordion li.cloud:target > a:before { background-position: -48px -24px; }
.accordion li.sign > a:before { background-position: -72px 0px; }
.accordion li.sign:hover > a:before,
.accordion li.sign:target > a:before { background-position: -72px -24px; }
/* Sub Menu */
.sub-menu li a {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: #e5e5e5;
border-bottom: 1px solid #c9c9c9;
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.sub-menu li:hover a { background: #efefef; }
.sub-menu li:last-child a { border: none; }
.sub-menu li > a span {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: transparent;
border: 1px solid #c9c9c9;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.sub-menu em {
position: absolute;
top: 0;
left: 0;
margin-left: 14px;
color: #a6a6a6;
font: normal 10px/32px Arial, sans-serif;
}
/* Functionality */
.accordion li > .sub-menu li {
height: 0;
overflow: hidden;
-webkit-transition: height .2s ease-in-out;
-moz-transition: height .2s ease-in-out;
-o-transition: height .2s ease-in-out;
-ms-transition: height .2s ease-in-out;
transition: height .2s ease-in-out;
}
.accordion li:target > .sub-menu li {
height: 33px;
}
I'm trying to avoid any java script.
Is this possible?
No this is not possible with only css, because your example uses the CSS3 :target selector. When you click on another item the target changes.
You cannot set state with css but you can style it. If you would like to keep each section open after clicking you would have to use javascript, but you don't need jQuery
If you would like to use javascript, this mimics the css as closely as possible while allowing the accordions to stay open. To close the accordion simply click on the title again.
var lists = document.querySelectorAll('.accordion > li > a'); // get list title links
for (var i = 0; i < lists.length; i++) { // for each list title link
lists[i].href = "javascript:void()"; // stop the page from jumping
lists[i].onclick = function(e) { // when you click the link
var items = e.target.parentNode.querySelectorAll('li'); // get all list items that are siblings of the clicked link
for (var x = 0; x < items.length; x++) { // for each list item
if (items[x].style.height != '33px') { // if its not open
items[x].style.height = '33px'; // open it
} else { // otherwise
items[x].style.height = '0px'; // close it
}
}
};
}
Wrap this in a script tag then either drop it in at the bottom of the body, or wrap it in document.onload = function() { /* Script Here */ }
(Demo)
Note while any style with the :target selector will cease to have effect, you should leave them in the css as a fallback in case the user has javascript disabled.
This css is showing all of the accordions as closed using this style:
.accordion li > .sub-menu li {
height: 0px;
}
You could set it to 33px to show all open when the page opens - but that would break the functionality as it is the :target selector which then sets the height and thus causes the selected section to show as open.
The only solution is to move into javascript.....
Can it be done? Yes
Do you need to change your HTML? Yes
Is it pretty? No
Basically instead of Target maintaining state. Use a checkbox replacing you top level a tags with label.
body {margin:50px;}
/* Reset */
.accordion,
.accordion ul,
.accordion li,
.accordion label,
.accordion span {
margin: 0;
padding: 0;
border: none;
outline: none;
}
.accordion li {
list-style: none;
}
.accordion input[type="checkbox"]{display:none;}
/* Layout & Style */
.accordion li > label, .accordion li > a {
display: block;
position: relative;
min-width: 110px;
padding: 0 10px 0 40px;
height: 32px;
color: #fdfdfd;
font: bold 12px/32px Arial, sans-serif;
text-decoration: none;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #6c6e74;
background: -moz-linear-gradient(top, #6c6e74 0%, #4b4d51 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6c6e74), color-stop(100%,#4b4d51));
background: -webkit-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -o-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -ms-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.accordion > li:hover > label,
.accordion > li:target > label,
.accordion > li > input[type="checkbox"]:checked ~ label{
color: #3e5706;
text-shadow: 1px 1px 1px rgba(255,255,255, .2);
/*background: url(../img/active.png) repeat-x;*/
background: #a5cd4e;
background: -moz-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a5cd4e), color-stop(100%,#6b8f1a));
background: -webkit-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -o-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -ms-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
}
.accordion li > label span, .accordion li > a span {
display: block;
position: absolute;
top: 7px;
right: 0;
padding: 0 10px;
margin-right: 10px;
font: normal bold 12px/18px Arial, sans-serif;
background: #404247;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
-moz-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
}
.accordion > li:hover > label span,
.accordion > li:target > label span,
.accordion > li > input[type="checkbox"]:checked ~ label span{
color: #fdfdfd;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #3e5706;
}
/* Images */
.accordion > li > label:before {
position: absolute;
top: 0;
left: 0;
content: '';
width: 24px;
height: 24px;
margin: 4px 8px;
background-repeat: no-repeat;
background-image: url(http://designmodo.com/demo/css3accordionmenu/img/icons.png);
background-position: 0px 0px;
}
.accordion li.files > label:before { background-position: 0px 0px; }
.accordion li.files:hover > labe:before,
.accordion li.files:target > label:before { background-position: 0px -24px; }
.accordion li.mail > label:before { background-position: -24px 0px; }
.accordion li.mail:hover > label:before,
.accordion li.mail:target > label:before { background-position: -24px -24px; }
.accordion li.cloud > label:before { background-position: -48px 0px; }
.accordion li.cloud:hover > label:before,
.accordion input[type="checkbox"]:checked:before { background-position: -48px -24px; }
.accordion li.sign > label:before { background-position: -72px 0px; }
.accordion li.sign:hover > label:before,
.accordion input[type="checkbox"]:checked:before { background-position: -72px -24px; }
/* Sub Menu */
.sub-menu li > a {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: #e5e5e5;
border-bottom: 1px solid #c9c9c9;
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.sub-menu li:hover a { background: #efefef; }
.sub-menu li:last-child a { border: none; }
.sub-menu li > a span {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: transparent;
border: 1px solid #c9c9c9;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.sub-menu em {
position: absolute;
top: 0;
left: 0;
margin-left: 14px;
color: #a6a6a6;
font: normal 10px/32px Arial, sans-serif;
}
/* Functionality */
.accordion li > .sub-menu li {
height: 0;
overflow: hidden;
-webkit-transition: height .2s ease-in-out;
-moz-transition: height .2s ease-in-out;
-o-transition: height .2s ease-in-out;
-ms-transition: height .2s ease-in-out;
transition: height .2s ease-in-out;
}
.accordion input[type="checkbox"]:checked ~ .sub-menu li {
height: 33px;
}
<ul class="accordion">
<li id="one" class="files">
<input type="checkBox" id="cbOne" checked="checked" /><label for="cbOne" >My Files<span>495</span></label>
<ul class="sub-menu">
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>02</em>Skydrive<span>87</span></li>
<li><em>03</em>FTP Server<span>366</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
</ul>
</li>
<li id="two" class="mail">
<input type="checkBox" id="cbTwo" checked="checked" /><label for="cbTwo" >Mail<span>26</span></label>
<ul class="sub-menu">
<li><em>01</em>Hotmail<span>9</span></li>
<li><em>02</em>Yahoo<span>14</span></li>
<li><em>03</em>Gmail<span>3</span></li>
</ul>
</li>
<li id="three" class="cloud">
<input type="checkBox" id="cbThree" checked="checked" /><label for="cbThree" >Cloud<span>58</span></label>
<ul class="sub-menu">
<li><em>01</em>Connect<span>12</span></li>
<li><em>02</em>Profiles<span>19</span></li>
<li><em>03</em>Options<span>27</span></li>
</ul>
</li>
<li id="four" class="sign">
<input type="checkBox" id="cbFour" checked="checked" /><label for="cbFour" >Sign Out</label>
<ul class="sub-menu">
<li><em>01</em>Log Out</li>
<li><em>02</em>Delete Account</li>
<li><em>03</em>Freeze Account</li>
</ul>
</li>
</ul>
Look Ma! No Javascript!
I am trying to build a drop down menu, So far i found a really nice menu but it lists its items horizontal and displays its sub items horizontally as well.
I would like my items to be next to each other and then if it has a sub menu those items drop down.
Here is my Menu:
<link rel="stylesheet" type="text/css" href="../../Content/Menu.css" />
<div class="float-right">
<nav>
<ul class="menu" style="float: left;">
<li class="item1">Home
<ul style="display: block; ">
<li class="subitem1" >#Html.ActionLink("Home", "Index", "Home", new { #class = "active" })</li>
<li class="subitem2">#Html.ActionLink("Contact", "Contact", "Home")</li>
<li class="subitem3">#Html.ActionLink("About", "About", "Home")</li>
</ul>
</li>
<li class="item2">#Html.ActionLink("Login", "Login", "Home")</li>
</ul>
</nav>
</div>
Style Sheet
body {
font-size: 100%;
background:#32373d;
}
a {
text-decoration: none;
}
ul, ul ul {
margin: 0;
padding: 0;
list-style: none;
}
#wrapper {
width: 220px;
margin: 100px auto;
font-size: 0.8125em;
}
.menu {
width: 225px;
height: auto;
-webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
-moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
}
.menu > li > a {
background-color: #616975;
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(114, 122, 134)),to(rgb(80, 88, 100)));
background-image: -webkit-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
background-image: -moz-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
background-image: -o-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
background-image: -ms-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
background-image: linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#727a86', EndColorStr='#505864');
border-bottom: 1px solid #33373d;
-webkit-box-shadow: inset 0px 1px 0px 0px #878e98;
-moz-box-shadow: inset 0px 1px 0px 0px #878e98;
box-shadow: inset 0px 1px 0px 0px #878e98;
width: 100%;
height: 2.75em;
line-height: 2.75em;
text-indent: 2.75em;
display: block;
position: relative;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 600;
color: #fff;
text-shadow: 0px 1px 0px rgba(0,0,0,.5);
}
.menu ul li a {
background: #fff;
border-bottom: 1px solid #efeff0;
width: 100%;
height: 2.75em;
line-height: 2.75em;
text-indent: 2.75em;
display: block;
position: relative;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 0.923em;
font-weight: 400;
color: #878d95;
}
.menu ul li:last-child a {
border-bottom: 1px solid #33373d;
}
.menu > li > a:hover, .menu > li > a.active {
background-color: #35afe3;
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(69, 199, 235)),to(rgb(38, 152, 219)));
background-image: -webkit-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
background-image: -moz-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
background-image: -o-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
background-image: -ms-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
background-image: linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#45c7eb', EndColorStr='#2698db');
border-bottom: 1px solid #103c56;
-webkit-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
-moz-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
box-shadow: inset 0px 1px 0px 0px #6ad2ef;
}
.menu > li > a.active {
border-bottom: 1px solid #1a638f;
}
.menu > li > a:before {
content: '';
background-image: url(../images/sprite.png);
background-repeat: no-repeat;
font-size: 36px;
height: 1em;
width: 1em;
position: absolute;
left: 0;
top: 50%;
margin: -.5em 0 0 0;
}
.item1 > a:before {
background-position: 0 0;
}
.item2 > a:before {
background-position: -38px 0;
}
.item3 > a:before {
background-position: 0 -38px;
}
.item4 > a:before {
background-position: -38px -38px;
}
.item5 > a:before {
background-position: -76px 0;
}
.menu > li > a span {
font-size: 0.857em;
display: inline-block;
position: absolute;
right: 1em;
top: 50%;
background: #48515c;
line-height: 1em;
height: 1em;
padding: .4em .6em;
margin: -.8em 0 0 0;
color: #fff;
text-indent: 0;
text-align: center;
-webkit-border-radius: .769em;
-moz-border-radius: .769em;
border-radius: .769em;
-webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
-moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
text-shadow: 0px 1px 0px rgba(0,0,0,.5);
font-weight: 500;
}
.menu > li > a:hover span, .menu > li a.active span {
background: #2173a1;
}
.menu > li > ul li a:before{
content: '▶';
font-size: 8px;
color: #bcbcbf;
position: absolute;
width: 1em;
height: 1em;
top: 0;
left: -2.7em;
}
.menu > li > ul li:hover a,
.menu > li > ul li:hover a span,
.menu > li > ul li:hover a:before {
color: #32373D;
}
.menu ul > li > a span {
font-size: 0.857em;
display: inline-block;
position: absolute;
right: 1em;
top: 50%; /
background: #fff;
border: 1px solid #d0d0d3;
line-height: 1em;
height: 1em;
padding: .4em .7em;
margin: -.9em 0 0 0;
color: #878d95;
text-indent: 0;
text-align: center;
-webkit-border-radius: .769em;
-moz-border-radius: 769em;
border-radius: 769em;
text-shadow: 0px 0px 0px rgba(255,255,255,.01));
}
What property in my style sheet is causing my Menu to list like this?
Is there a way to override what every is causing the menu you to do this?
Edit
Html list:
<div class="float-right">
<nav>
<ul class="menu" style="float: left;">
<li class="item1">Home
<ul style="display: block; ">
<li class="subitem1" ><a class="active" href="/?Length=4">Home</a></li>
<li class="subitem2">Contact</li>
<li class="subitem3">About</li>
</ul>
</li>
<li class="item2">Login</li>
</ul>
</nav>
</div>
.menu {
width: 225px;
}
the width:225px prevents the menu from displaying correctly.
http://jsfiddle.net/wFyMs/2/
Why can you make it simplier?
Try rewrite it by this pattern:
CSS
li { float: left; }
li ul li { clear: both; }
I have the 2 divs that I want styled the same. One is called #popover, the other is called #recordViewPopover. Here is my CSS for popover. How can I make #recordViewPopover use the same CSS as #popover?
#popover {
-webkit-border-radius: 4px;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-webkit-transition: opacity 0.25s linear;
-moz-border-radius: 4px;
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-moz-transition: opacity 0.25s linear;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
transition: opacity 0.25s linear;
border: 3px solid black;
border-radius: 4px;
background-color: white;
color: black;
cursor: auto;
display: none;
font-weight: normal;
line-height: 1;
position: absolute;
right: 22px;
z-index: 5000000;
}
#popover > .popover_triangle
{
border-top: 16px solid rgba(0,0,0,0);
border-left: 16px solid rgba(0,0,0,0);
border-right: 16px solid rgba(0,0,0,0);
border-bottom: 16px solid black;
font-size: 0px;
line-height: 0%;
position: absolute;
top: -34px;
left:150px;
width: 0px;
}
#popover > .header
{
background: #222;
background: -moz-linear-gradient(top, #333 0%, #111 100%);
background-image: -webkit-gradient(
linear,
left top,
left bottom,
from(rgba(255, 255, 255, 0.55)),
color-stop(0.2, rgba(255, 255, 255, 0.35)),
color-stop(0.5, rgba(255, 255, 255, 0.1)),
color-stop(0.5, transparent),
to(transparent));
color: white;
font-weight: bold;
height: 27px;
line-height: 25px;
margin: 0;
padding: 3px;
text-shadow: rgba(0, 0, 0, 1) 0 -1px 0;
text-align: center;
}
#popover > .content
{
font-size: 12px;
max-height: 400px;
overflow-x: hidden;
overflow-y: auto;
width: 190px;
}
#popover > .content ul
{
list-style: none;
margin: 0;
padding: 0;
}
#popover > .content ul li
{
border-bottom: #ccc 1px solid;
line-height: 25px;
}
#popover > .content ul li.item:hover
{
border-bottom: #1443be 1px solid;
}
#popover > .content ul li h6
{
background: #f3f3f3;
display: block;
color: #000;
font-size: 13px;
padding: 0 10px;
text-shadow: rgba(255, 255, 255, 1) 0 -1px 0;
}
#popover > .content ul li a
{
display: block;
padding: 0 14px;
}
#popover > .content ul li a:link,
#popover > .content ul li a:visited
{
text-decoration:none;color:#333;
}
#popover > .content ul li a:focus,
#popover > .content ul li a:hover
{
background: #5396e3 url('../images/arrow-small.png') 97% center no-repeat;
color: #fff;
text-decoration: none;
text-shadow: rgba(0, 0, 0, .55) 0 -1px 0;
}
Here are my divs
<div id='popover'>
<div class='popover_triangle'></div>
<div class='header'>OPTIONS</div>
<div class='content'>
<ul>
<li><h6>OBJECT VIEW</h6></li>
<li class='item'><a onclick=\"$(document).trigger('objectViewFiltersEnabled', [ !filtersEnabled ]);\">Filters</a></li>
<li class='item'><a href=\"#\" >Configuration</a></li>
<li><h6>OBJECT</h6></li>
<li class='item'><a href=\"#\" >Configuration</a></li>
<li class='item'><a href=\"#\" >Documentation</a></li>
</ul>
</div>
</div>
<div id='recordViewPopover'>
<div class='popover_triangle'></div>
<div class='header'>OPTIONS</div>
<div class='content'>
<ul>
<li><h6>Information</h6></li>
<li class='item'><a href='#' >Change Logs</a></li>
<li><h6>Actions</h6></li>
<li class='item'><a href='#' >Assign</a></li>
<li class='item'><a href='#' >Share</a></li>
<li class='item'><a href='#' >Convert</a></li>
<li class='item'><a href='#' >Copy</a></li>
<li class='item'><a href='#' >Clone</a></li>
<li class='item'><a href='#' >Merge</a></li>
<li class='item'><a href='#' >Refresh</a></li>
<li class='item'><a href='#' >Delete</a></li>
</ul>
</div>
</div>
You would assign them both the same class. To do this you would have:
<div id='popover' class='someName'>
<div id='recordViewPopover' class='someName'>
and your CSS would be declared:
.someName {
//Add styles here
}
You could group multiple selectors:
#popover > .popover_triangle,
#recordViewPopover > .popover_triangle {
Or give the elements a class, and use a class selector where you have the id selector.
.popover > .popover_triangle {
#popover, #recordViewPopover {
...
}
Oh, and also
#popover > .popover_triangle,
#recordViewPopover > .popover_triangle {
...
}
But if you expect to have more divs like these two, it would indeed be better to define a class for them.