I can not seem to figure out why my menu does not align properly on the sub dropdowns. They display at the lower edge of its parent cell and it makes trying to navigate through them almost impossible. You have to drop down diagonally just right to get the next menu.
http://imgur.com/zxWcmZf "Screenshot of menu"
I have posted the menu's code below does anything stand out to anyone as to what I am missing? This is my first play with bootstrap. Thanks a million for everyone's time on help with this.
<div class="navbar-wrapper">
<div class="container">
<div class="navbar">
<div class="navbar-inner">
<div class="buttons-container">
</div>
<ul class="blue nav" id="css3-menu">
<li>Home </li>
<li class="dropdown"><a tabindex="-1" class="dropdown-toggle_" data-toggle="dropdown"
href="">Choice 1</a>
<ul class="dropdown-menu">
<li class="dropdown-submenu"><a tabindex="-1" href="#">Choice 1a</a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">Choice 1a1
<ul class="dropdown-menu">
<li><a tabindex="-1" href="">Choice 1a1a</a></li>
<li><a tabindex="-1" href="">Choice 1a1b</a></li>
</ul>
</li>
<li class="dropdown-submenu">Choice 1a2
<ul class="dropdown-menu">
<li><a tabindex="-1" href="">Choice 1a2a</a></li>
<li><a tabindex="-1" href="">Choice 1a2b</a></li>
</ul>
</li>
<li class="dropdown">Choice 1b </li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle_" data-toggle="dropdown" href="">Choice
2</a>
<ul class="dropdown-menu">
<li>Choice 2a</li>
<li>Choice 2b</li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle_" data-toggle="dropdown" href="">Choice
3</a>
<ul class="dropdown-menu">
<li>Choice 3a</li>
<li>Choice 3b</li>
</ul>
</li>
<li>Choice 4 </li>
<li>Choice 5 </li>
</ul>
</div>
</div>
</div>
</div>
EDIT:
Sorry I forgot the CSS don't know what I was thinking. Here is the CSS relating to it. Thanks for the input so far :)
/* css3 menu */
ul#css3-menu{
width: 940px;
min-width: 940px;
margin: 0 auto;
list-style: none;
font-family: 'Open Sans', Arial, "MS Trebuchet", sans-serif;
height: 46px;
padding: 0;
}
ul#css3-menu > li{
display: block;
float: left;
-webkit-transition: background .4s linear;
-moz-transition: background .4s linear;
-ms-transition: background .4s linear;
-o-transition: background .4s linear;
transition: background .4s linear;
<!--[if IE]>
position: relative;
<![endif]-->
}
ul#css3-menu > li:first-child{
border-left: none !important;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft: 4px;
-ms-border-top-left-radius: 4px;
-ms-border-bottom-left-radius: 4px;
-o-border-top-left-radius: 4px;
-o-border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
ul#css3-menu > li:last-child{
border-right: none !important;
}
ul#css3-menu > li > a{
display: block;
padding: 15px 30px;
color: white;
text-decoration: none;
font-weight: 600;
font-weight: bold;
}
/*
ul#css3-menu > li:hover > div{
-webkit-transform: translateY(-80px);
-moz-transform: translateY(-80px);
-ms-transform: translateY(-80px);
-o-transform: translateY(-80px);
transform: translateY(-80px);
}
*/
/*visibility: visible;*/
ul#css3-menu > li > div{
-webkit-transition: -webkit-transform .2s linear;
-moz-transition: -moz-transform .2s linear;
-ms-transition: -ms-transform .2s linear;
-o-transition: -o-transform .2s linear;
transition: transform .2s linear;
text-align: center;
margin: 0 auto;
-webkit-transform: translateY(-60px);
-moz-transform: translateY(-60px);
-ms-transform: translateY(-60px);
-o-transform: translateY(-60px);
transform: translateY(-60px);
width: 37px;
height: 37px;
/*visibility: hidden;*/
margin-bottom: -37px;
z-index: -1;
<!--[if IE]>
margin-top: -60px;
<![endif]-->
}
ul#css3-menu.blue > li > div{
background: url(../img/icons-blue.png) 0 0 no-repeat;
}
.navbar-wrapper {
background: #2773AE;
background-color:#2773AE; filter: progid:DXImageTransform.Microsoft.dropShadow(color=#2773AE, offX=0, offY=0, positive=true);
box-shadow: 0 -10px 8px -10px #074979 inset, 0 10px 8px -10px #074979 inset;
-webkit-box-shadow: 0 -10px 8px -10px #074979 inset, 0 10px 8px -10px #074979 inset;
-moz-box-shadow: 0 -10px 8px -10px #074979 inset, 0 10px 8px -10px #074979 inset;
}
ul#css3-menu.blue{
background: #2773AE;
background-color:#2773AE; filter: progid:DXImageTransform.Microsoft.dropShadow(color=#2773AE, offX=0, offY=0, positive=true);
box-shadow: 0 -10px 8px -10px #074979 inset, 0 10px 8px -10px #074979 inset;
-webkit-box-shadow: 0 -10px 8px -10px #074979 inset, 0 10px 8px -10px #074979 inset;
-moz-box-shadow: 0 -10px 8px -10px #074979 inset, 0 10px 8px -10px #074979 inset;
}
ul#css3-menu.blue > li{
border-right: 1px #074979 solid;
border-left: 1px #3e92d0 solid;
height: 46px;
}
ul#css3-menu.blue > li:hover{
background: #074979;
}
It is something in your additional CSS file (that you haven't posted) that is causing this, not the html you posted, nor any of the bootstrap css files. When I test the html you posted (my entire html file below), I get the dropdowns to align as expected: http://imgur.com/XyYV5pE.
You may want to post the CSS you are including so folks can look at what might be causing this -- or simplify your CSS to bare bones and add each part back one by one to track the culprit.
<!DOCTYPE html>
<html lang="en">
<head>
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" media="screen" rel="stylesheet" type="text/css"/>
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css" media="screen" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap.js"></script>
</head>
<body>
<!--your exact markup posted in its entirety, unaltered, here-->
</body>
Related
I created a mega menu that has 4 items, it is working well.
The problem is when hovering over an item it goes to the previous last one I hover over it.
here is a snap of my code,
<nav class="main-menu">
<div class="navbar-header">
<div class="navbar-collapse collapse clearfix">
<ul class="navigation clearfix">
<li class="dropdown has-mega-menu is-dropdown-submenu-parent">
<a href="home.php" >Home</a>
<div class="mega-menu">
/* list of items */
</div>
</li>
<li class="dropdown has-mega-menu is-dropdown-submenu-parent">
<a href="projects.php" >Projects</a>
<div class="mega-menu">
/* list of items */
</div>
</li>
/* two more li items for the menu */
</ul>
</div>
</div>
</nav>
CSS Code,
.main-menu .navigation > li > .mega-menu{
position:absolute;
left:0px;
width:100%;
background-color: #ffffff;
padding: 30px;
top: 100%;
z-index:-1;
margin-top:0px;
display:none;
background-position:right bottom;
background-repeat:no-repeat;
transition:all 500ms ease;
-webkit-transition:all 500ms ease;
-moz-transition:all 500ms ease;
-ms-transition:all 500ms ease;
-o-transition:all 500ms ease;
-webkit-box-shadow:0px 2px 5px 1px rgba(0,0,0,0.4),0px 0px 5px 1200px rgba(0,0,0,0.55);
-ms-box-shadow:0px 2px 5px 1px rgba(0,0,0,0.4),0px 0px 5px 1200px rgba(0,0,0,0.55);
-o-box-shadow:0px 2px 5px 1px rgba(0,0,0,0.4),0px 0px 5px 1200px rgba(0,0,0,0.55);
-moz-box-shadow:0px 2px 5px 1px rgba(0,0,0,0.4),0px 0px 5px 1200px rgba(0,0,0,0.55);
box-shadow:0px 2px 5px 1px rgba(0,0,0,0.4),0px 0px 5px 1200px rgba(0,0,0,0.55);}
.main-menu .navigation > li:hover > .mega-menu{
opacity:1;
visibility:visible;
}
I want to know what is causing this problem, I just add in the CSS file simple hovering effects to show the drop-down menu.
I have a vertical nav "slider" that now needs to be dynamically resized based in the number of links available to the user. I've searched all over, but all the solutions I've found haven't quite worked. It may simply be the way I have my css working. Any time I try to change the height attribute, the whole thing goes haywire. I'm trying to do this entirely in css. I know it seems like it should be simple, I just can't figure it out myself.
It's basically:
<div class="slideMenu">
<ul class="nav">menu items...</ul>
</div>
Here's the css:
.slideMenu {
background: #449bb5;
width: 140px;
height: 100%;
padding-right: 40px;
position: absolute;
z-index: 3;
-webkit-box-shadow: -3px 0px 5px 0px rgba(0, 0, 0, 0.2);
box-shadow: 3px 0px 5px 0px rgba(0, 0, 0, 0.2);
left: -180px;
color: #FFFFFF;
opacity: 100;
transition: .4s ease-in-out;
}
.slideMenu:not(:hover) {
transition-delay: .4s;
}
.slideMenu:hover {
transform: translate3d(160px, 0, 0);
}
.slideMenu .nav {
position: absolute;
top: 30%;
height: auto;
-webkit-transform: translateY(50%);
-ms-transform: translateY(50%);
transform: translateY(-50%);
font-weight: 400;
}
JSFiddle here
You don't need to specify a height. Doing so in this instance with 100% says that the height is 100% of it's parent container... The body. Not what you want. Leave it out. You have other issues here that you can improve, which I marked in the comments of the code below.
body {
margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, "sans-serif" !important;
font-size: 12px;
}
.slideMenu {
background: #449bb5;
width: 140px;
/* height: 100%; remove this */
padding-right: 40px;
position: absolute;
z-index: 3;
-webkit-box-shadow: -3px 0px 5px 0px rgba(0, 0, 0, 0.2);
box-shadow: 3px 0px 5px 0px rgba(0, 0, 0, 0.2);
left: -180px;
top: 0;
color: #FFFFFF;
opacity: 100;
transition: .4s ease-in-out;
}
.slideMenu:not(:hover) {
transition-delay: .4s;
}
.slideMenu:hover/*, .slideMenu:focus*/ {
transform: translate3d(160px, 0, 0);
}
.slideMenu .nav {
/*position: absolute; changed to relative */
position: relative;
top: 30%;
/* height: auto; remove. unnecessary */
/*
-webkit-transform: translateY(50%);
-ms-transform: translateY(50%);
transform: translateY(-50%);
remove this. it's trying to center your menu */
font-weight: 400;
}
.slideMenu .nav li {
padding-bottom: 10px;
padding-top: 10px;
list-style-type: none;
}
.slideMenu .nav li a {
display: block;
text-decoration: none;
color: white;
cursor: pointer;
}
.slideMenu .nav li a:hover {
color: #aaa;
}
.slideMenuTab {
background: #449bb5;
position: relative;
width: 40px;
z-index: 3;
-webkit-box-shadow: -3px 0px 5px 0px rgba(0, 0, 0, 0.2);
box-shadow: 3px 0px 5px 0px rgba(0, 0, 0, 0.2);
left: 165px;
color: #FFFFFF;
text-align: right;
padding-right: 8px;
padding-top: 6px;
padding-bottom: 3px;
border-radius: 8px;
cursor: pointer;
}
<div class="slideMenu">
<div class="slideMenuTab"><img src="images/hamburger.png"/></div>
<ul class="nav">
<li><a data-type="ticketdialogbutton" data-class="PickTicket">Create Pick</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="ReturnTicket">Create Return</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="AdjustmentTicket">Create Adjustment</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="CreateMTRTicket">Create MTR</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="ReceiveMTRTicket">Receive MTR</a></li>
<hr>
<li>Order Signage </li>
<li><a data-type="ticketdialogbutton" data-class="PickTicket">Create Pick</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="ReturnTicket">Create Return</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="AdjustmentTicket">Create Adjustment</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="CreateMTRTicket">Create MTR</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="ReceiveMTRTicket">Receive MTR</a></li>
<hr>
<li>Order Signage </li>
<li><a data-type="ticketdialogbutton" data-class="PickTicket">Create Pick</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="ReturnTicket">Create Return</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="AdjustmentTicket">Create Adjustment</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="CreateMTRTicket">Create MTR</a></li>
<hr>
<li><a data-type="ticketdialogbutton" data-class="ReceiveMTRTicket">Receive MTR</a></li>
<hr>
<li>Order Signage</li>
</ul>
</div>
How do i add a dropdown menu for both of my material-icons list? I managed to done the html part. I tried many times on the css by adding dropdown codes but it doesnt work, the dropdown menu get stuck in between the nav bar. Whats happening and what can i do to resolve this?
body {} #nav-main {
width: 1280px;
min-width: 100%;
position: fixed;
top: 0;
left: 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.39);
height: 60px;
}
li {
float: left;
}
li a {
display: block;
color: #ffffff;
text-align: center;
padding: 19px 25px;
/*topbottom leftright*/
text-decoration: none;
}
.nav-item5 {
width: 550px;
margin: 15px 60px;
/*topbottom leftright*/
padding: 5px;
}
input[type="search"] {
background: url(../images/search-icon.png) no-repeat #fcfcfc;
border: 1px solid #d1d1d1;
background-size: contain;
padding: 6px 15px 6px 30px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
input[type="search"]:focus {
width: 300px;
}
i.material-icons {
font-size: 27px;
}
li a:hover {
background-color: rgba(0, 0, 0, 0.50);
}
<ul id="nav-main">
<li>Home
</li>
<li>About
</li>
<li>FAQ
</li>
<li>Contact
</li>
<li>
<form action="action_page.php">
<input type="search" name="savanasearch" placeholder="Search..." class="nav-item5">
</form>
</li>
<li style="float:right">
<i class="material-icons">account_circle</i>
<div class="dropdown">
Welcome
<ul>
<li>Login
</li>
<li>Register
</li>
</ul>
</div>
</li>
<li style="float:right">
<i class="material-icons">favorite_border</i>
<div class="dropdown">
<ul>
<li>Favorites
</li>
<li>Wishlist
</li>
<li>Track Order
</li>
</ul>
</div>
</li>
</ul>
See this example
I've changed a little bit you navbar cause you got a class for each one, an it's not right if you don't need them. Also the size of the search-bar. Check the example. I leave you some examples to let you know the "why?"
.dropdown ul{
z-index: 9;
top: 101%;
position: absolute;
display: none;
}
Ok, so I have looked around for the past two days to try and fix this problem, and I cannot find a solution. I am trying to create a site using asp.net and am attempting to center the navbar. Now, it is almost centered, my onnly problem is that there is a gap on the left side of the nav bar, here is a pic to show:
I have tried practically everything from changing float style, display, padding, margin, and text indents, and nothing is working. can someone please help? Thank you.
nav {
font-family:'Electrolize',sans-serif;
font-size: 0.7em;
height: 60px;
margin: 0px auto;
padding: 0;
position: relative;
width: 70%;
}
nav ul li {
background-color: rgb(192, 64, 0);
border-radius:10px 10px 0 0;
-moz-border-radius:10px 10px 0 0;
-o-border-radius:10px 10px 0 0;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
-o-box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
-webkit-box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
color:#eee;
float: left;
list-style:none;
margin-left: 0 !important;
padding: 0;
text-align: center;
text-indent: 0;
text-decoration:none;
transition:all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition:all 0.2s ease-in-out;
-webkit-transition:all 0.2s ease-in-out;
vertical-align: baseline;
width: 20%;
}
<form id="form1" runat="server">
<div>
<header>
<img class="headerImg" runat="server" src="~/Resources/header_1.png" />
</header>
<nav>
<ul>
<li><a href="home.aspx" >Home</a></li>
<li><a href="#" >About Us</a></li>
<li><a href="#" >Policies</a></li>
<li><a href="#" >FAQ's</a></li>
<li><a href="#" >Contact Us</a></li>
</ul>
</nav>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
</div>
</form>
Add padding 0(zero) to the ul
nav {
font-family:'Electrolize',sans-serif;
font-size: 0.7em;
height: 60px;
margin: 0px auto;
padding: 0;
position: relative;
width: 70%;
}
nav ul{
padding: 0px;
}
nav ul li {
background-color: rgb(192, 64, 0);
border-radius:10px 10px 0 0;
-moz-border-radius:10px 10px 0 0;
-o-border-radius:10px 10px 0 0;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
-o-box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
-webkit-box-shadow:2px 2px 4px rgba(0, 0, 0, 0.9) inset;
color:#eee;
float: left;
list-style:none;
margin-left: 0 !important;
padding: 0;
text-align: center;
text-indent: 0;
text-decoration:none;
transition:all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition:all 0.2s ease-in-out;
-webkit-transition:all 0.2s ease-in-out;
vertical-align: baseline;
width: 20%;
}
<form id="form1" runat="server">
<div>
<header>
<img class="headerImg" runat="server" src="~/Resources/header_1.png" />
</header>
<nav>
<ul>
<li><a href="home.aspx" >Home</a></li>
<li><a href="#" >About Us</a></li>
<li><a href="#" >Policies</a></li>
<li><a href="#" >FAQ's</a></li>
<li><a href="#" >Contact Us</a></li>
</ul>
</nav>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
</div>
</form>
after applying a background image to the body, the menu buttons backgrounds are overridden as seen below. i want the menu buttons to preserve their visibility.
link to image is below
http://s11.postimage.org/4ndla4hxf/111111111.jpg
/********markup********/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
<link href="#Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="#Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
</head>
<body>
<div class="page">
<header>
<div id="title">
<h1>My MVC Application</h1>
</div>
<div id="logindisplay">
#Html.Partial("_LogOnPartial")
</div>
<nav>
<ul id="menu">
<li >#Html.ActionLink("Home", "Index", "Home")</li>
<li>#Html.ActionLink("About", "About", "Home")</li>
</ul>
</nav>
</header>
<section id="main">
#RenderBody()
</section>
<footer>
</footer>
</div>
</body>
</html>
/*******body***********/
body
{
font-size: .85em;
font-family: "Trebuchet MS" , Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
background-image:url('/Content/bw.jpg');
}
/*******menu**********/
#menu
{
position:relative;
float:left;
clear:left;
margin-right:50px;
}
#menu li
{
list-style-type: none;
padding: 0px;
display: block;
width:150px;
overflow:visible;
}
#menu li a
{
overflow:visible;
background: rgba(0,0,0,0.2);
text-shadow: 0px 0px 1px white;
color: white;
text-decoration: none;
font-size: 13px;
display: block;
font-family: arial;
text-transform: uppercase;
text-shadow: 0px 0px 5px #eee;
padding:10px 20px 10px;
margin: 5px;
font-weight: bold;
letter-spacing: 1px;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
-webkit-box-shadow: 2px 3px 3px rgba(0,0,0,0.6);
-moz-box-shadow: 2px 3px 3px rgba(0,0,0,0.6);
box-shadow: 2px 3px 3px rgba(0,0,0,0.6);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
#menu li a:hover
{
opacity: 1;
color:White;
background:#FF00D0 ;
text-shadow: 0px 0px 1px #ffffff;
-webkit-transform: scale(1.1);
-moz-transform: scale(1.2);
-ms-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
}
#menu li a:active {
background: rgba(0,0,0,0.1);
-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.4);
-moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.4);
box-shadow: 1px 1px 1px rgba(0,0,0,0.4);
}
Are you sure the buttons don't just look grey when there's no background image as opacity is so low.
When you then apply the background image you cant see the buttons background colour as the the opacity is so low and the background colour so strong.
Temporarily update #menu li a and see if the problem still exists.
background: #FF0000;
Example here: http://benjaminhopkins.co.uk/BGLostExample.html