I am facing the problem that the jquery-tab block my Main menu class="oe_wrapper" that is located on the nav bar id="NavBar". I want the oe_menu can overlay the tabs. Is there any problem with this code? thanks in advance.
http://jsfiddle.net/Sp7Mk/
mark-up:
<div id="NavBar" style="width: 500px; height: 100px; background-color: blue;">
<div class="oe_wrapper" style="background-color: red;">
<ul id="oe_menu" class="oe_menu">
<li>
Main Menu
<div>
<ul>
<li class="oe_heading">
My Account
</li>
<li>Account Information</li>
</ul>
<ul>
<li class="oe_heading">
Forms
</li>
<li>F-1</li>
<li>F-2</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div id="searchTab">
<ul>
<li>Address</li>
<li>Other</li>
<li>Disabled</li>
</ul>
<div id="tabsAddll">
<p>Address</p>
</div>
<div id="tabsOther">
<p>Other</p>
</div>
<div id="tabsDis">
<p>Disabled</p>
</div>
</div>
js:
$(document).ready(function(){
$( "#searchTab" ).tabs({ disabled: [ 2 ] });
});
css:
*{ margin: 0 auto;}
body {
background:#000000;
}
ul.oe_menu{
list-style:none;
position:relative;
float:right;
clear:both;
left: -400px;
}
ul.oe_menu > li{
padding-bottom:2px;
float:left;
position:relative;
}
ul.oe_menu > li > a{
display:block;
background-color:#717171;
color:#ffffff;
text-decoration:none;
font-weight:bold;
font-size:12px;
/* a link */
width:90px;
height:16px;
padding:1.3px;
margin:1px;
text-shadow:0px 0px 1px #000;
/*opacity:0.8;*/
text-align: center !important;
}
ul.oe_menu > li > a:hover,
ul.oe_menu > li.selected > a{
background:#fff;
color:#101010;
opacity:1.0;
}
.oe_wrapper ul.hovered > li > a{
background:#fff;
text-shadow:0px 0px 1px #FFF;
}
ul.oe_menu div{
position:absolute;
left:1px;
background:#fff;
width:668px;
padding:30px;
}
ul.oe_menu div ul li a{
text-decoration:none;
color:#222;
padding:2px 2px 2px 4px;
margin:2px;
display:block;
font-size:12px;
}
ul.oe_menu div ul.oe_full{
width:100%;
}
ul.oe_menu div ul li a:hover{
background:#000;
color:#fff;
}
ul.oe_menu li ul{
list-style:none;
float:left;
width: 150px;
margin-right:10px;
text-align: left;
}
li.oe_heading{
color:#aaa;
font-size:16px;
margin-bottom:10px;
padding-bottom:6px;
border-bottom:1px solid #ddd;
width: 150px;
text-align: left;
}
In the line
<div id="NavBar" style="width: 500px; height: 100px; background-color: blue;">
You are explicitly declaring a height for the navbar of 100px, so after 100px it's space in the DOM ends and the next element starts to render. Try changing the height to 175px, for me that put it right underneath your other menu.
Related
I have a problem with dropmenu. I created dropmenu from li:YOU and I want to create dropmenu from li: VIEW and HELP, but every dropmenu is below YOU. I don't know what I should to do that every dropmenu was below YOU, VIEW and HELP. I tried many ways but everything failed. And I have ask, I want to pubblish my question but show information that I have to add more detail.
*{
margin:0;
padding:0;
box-sizing:border-box;
}
body {
text-align: center;
background: #e0e0e0;
padding-bottom: 200px;
}
nav{
height:100px;
display:flex;
font-size:15px;
align-items:center;
justify-content:center;
text-transform:uppercase;
background-color:blue;
width:100%;
position:relative;
}
nav ul{
display:flex;
}
nav ul li{
list-style:none;
}
nav ul li a{
text-decoration:none;
color:black;
position:relative;
letter-spacing:2px;
padding:20px 20px;
margin:20px 0;
font-weight:bold;
background-color:green;
}
.dropOut .triangle{
width:0;
height:0;
position:absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid red;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain{
width:160px;
position:absolute;
margin-top:20px;
left:50%;
margin-left: -80px;
}
.dropOut{
width:160px;
background-color:yellow;
position:relative;
opacity:0;
}
.dropOut ul {
text-align:center;
padding: 10px 0;
display:block;
}
.dropOut ul li {
text-align: center;
width:160px;
padding: 12px 0 10px 0;
margin: 0px ;
color: red;
}
.dropOut ul li:hover {
background: #0D74FB;
}
nav ul li a:hover{
color:white;
}
ul li:hover a { color: white; }
ul li:hover .dropdownContain { top: 65px; }
ul li:hover .underline { border-bottom-color: #777; }
ul li:hover .dropOut { opacity: 1; margin-top: 8px; }
<nav>
<ul>
<li>View</li>
<li>You
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Plan</li>
<li>Gallery</li>
<li>Contact</li>
<li>f1</li>
</ul>
</div>
</div>
</li>
<li>Help <div class="dropdownContain1">
<div class="dropOut">
<div class="tringle"></div>
<ul>
<li>Plan</li>
<li>Service</li>
<li>Contact</li>
<li>gallery</li>
</ul>
</div>
</div>
</li>
</ul>
</nav>
I want to make my menu's center on the navbar using materializecss
My HTML code:
<div class="navbar-utility theme">
<ul class="right">
<li>
<a href="#" id="navbar-search-trigger">
<i class="material-icons">search</i>
</a>
</li>
<li>
<a href="#" id="navbar-full-screen">
<i class="fa fa-arrows-alt tiny"></i>
</a>
</li>
<li>
<a class="dropdown-button" href="#!" data-activates="dropdown1">
Dropdown
<i class="material-icons right">arrow_drop_down</i>
</a>
</li>
</ul>
</div>
My CSS code is below:
.navbar-utility{
-webkit-box-shadow: inset 0 20px 20px -20px rgba(0,0,0,0.8);
-moz-box-shadow: inset 0 20px 20px -20px rgba(0,0,0,0.8);
box-shadow: inset 0 20px 20px -20px rgba(0,0,0,0.8);
width: 100%;
position: fixed;
top: 64px;
text-align: center;
}
.navbar-utility ul.right{
float: left;
clear: both;
margin:0px auto;
text-align:center;
}
but this doesn't seem to work. Any help would be appreciated.
You just try this code..
<div id="menu">
<ul>
<li>Tab one</li>
<li>Tab two</li>
<li>Tab three</li>
<li>Tab four</li>
</ul>
</div>
#menu {
float:left;
width:100%;
background:#fff;
border-bottom:4px solid #000;
overflow:hidden;
position:relative;
}
#menu ul {
clear:left;
float:left;
list-style:none;
margin:0;
padding:0;
position:relative;
left:50%;
text-align:center;
}
#menu ul li {
display:block;
float:left;
list-style:none;
margin:0;
padding:0;
position:relative;
right:50%;
}
#menu ul li a {
display:block;
margin:0 0 0 1px;
padding:3px 10px;
background:#ddd;
color:#000;
text-decoration:none;
line-height:1.3em;
}
#menu ul li a:hover {
background:#369;
color:#fff;
}
#menu ul li a.active,
#menu ul li a.active:hover {
color:#fff;
background:#000;
font-weight:bold;
}
Made this menu this afternoon. Tab number 1 has a drop down that consists of two divs that should each be floated left so there are two divs next to each other, however, it does not work and the second lines up underneath the first.
This is the line which I thought would do the floating :
/*sub container div*/
.container ul li .drop div{
float:left;
}
Fiddle
HTML
<!-- start menu -->
<div id="top_menu">
<nav>
<div class="container">
<ul>
<li><img class="home" alt="" height="20" src="/images/trans.gif" width="20"> </li>
<li>number 1
<div class="drop">
<div>
category 1
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
<li>test4</li>
</ul>
category 2
<ul>
<li>test1</li>
</ul>
</div>
<div>
category 3
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
<li>test4</li>
</ul>
category 4
<ul>
<li>test1</li>
</ul>
category 5
<ul>
<li>test1</li>
</ul>
</div>
<div>
</div>
</li>
<li>number 2</li>
<li>number 3</li>
<li>number 4</li>
<li>number 5</li>
</ul>
</div>
</nav>
</div>
<!-- end menu -->
CSS
#top_menu{
background:#cccccc url('/images/top_menu_bg.png') repeat;
}
.container{
position:relative;
z-index:1000;
border-left:1px #b2b2b2 solid;
border-right:1px #b2b2b2 solid;
}
.container ul{
white-space:nowrap;
/*display:table;*/
}
.container ul, .container li{
padding:0;
margin:0;
list-style:none;
}
/*top level link*/
.container ul a{
display:block;
color:#666666;
text-decoration:none;
padding:0 25px;
line-height:40px;
border-right:1px #b2b2b2 solid;
}
/*sub container*/
.container ul li .drop{
position:absolute;
background:#fdfdfd;
-moz-border-radius:0 0 8px 8px;
-webkit-border-radius:0 0 8px 8px;
border-radius:0 0 8px 8px;
display:none;
border-left:1px #b2b2b2 solid;
border-right:1px #b2b2b2 solid;
border-bottom:1px #b2b2b2 solid;
}
/*sub container div*/
.container ul li .drop div{
float:left;
}
.container ul li .drop li{
display:block;
border:0;
}
.container > ul > li{
float:left;
display:block;
position:relative;
}
.container ul li:hover > .drop{
top:auto;
display:block;
}
/*sub level top link*/
.container ul li .drop a{
line-height:25px;
border:0;
padding:0 30px 0 10px;
color:#000000;
}
/*sub level top link hover*/
.container ul li .drop a:hover{
color:#00396d;
background:#c4dcec;
}
/*sub level link normal*/
.container ul li .drop li > a{
color:#666666;
}
/*sub level link hover*/
.container ul li .drop li:hover > a{
background:#c4dcec;
color:#00396d;
}
/*top level link hover*/
.container li:hover > a{
color: #000000;
}
/*home button*/
.container ul li img.home{
background:url('/images/top_menu_home.png') 0 0;
width:20px;
height:20px;
}
/*home button hover*/
.container ul li:hover > a img.home{
background:url('/images/top_menu_home.png') -20px 0;
}
Sorry for the late reply =) Still, if you want to stack several elements of variable width horizontally, I'd suggest using display:inline-block.
/*sub container div*/
.container ul li .drop div{
display:inline-block;
vertical-align:top;
}
The fiddle (works in fFF 8, Chrome 12, IE 9).
The drawback is spaces between elements, which can be successfully eliminated
.container ul li .drop{
position:absolute;
background:#fdfdfd;
-moz-border-radius:0 0 8px 8px;
-webkit-border-radius:0 0 8px 8px;
border-radius:0 0 8px 8px;
display:none;
border-left:1px #b2b2b2 solid;
border-right:1px #b2b2b2 solid;
border-bottom:1px #b2b2b2 solid;
width: 300px; //set width
}
/*sub container div*/
.container ul li .drop div{
float:left;
width:50%; //optional
}
I have a horizontal menu based on this that is pure CSS and HTML and am trying to center align the dropdown divs under each top level menu item but am having some difficulty getting it to work. It currently aligns to the right, and any changes I make when changing to "relative" positioning of the child elements correct alignment of the parent/child but then throw off the top level items because the children take up the space between items.
Below is the code for an item, followed by the associated CSS.
Html:
<ul id="menu">
<li>Home
<div class="dropdown_2columns">
<div class="col_1">
<p class="black_box">Download stuff here<br><img src="img/menu-button.png"></a></p>
</div>
<div class="col_1">
<ul>
<li><a href="#">Item 1</li>
<li><a href="#">Item 2</li>
<li><a href="#">Item 3</li>
</ul>
</div>
</div>
</li>
CSS
#menu {
text-align:center;
color: #2262a0;
list-style:none;
width:690px;
margin:30px auto 0px auto;
height:28px;
padding:0px 20px 10px 20px;
background: #fff;
}
#menu li {
float:left;
display:block;
text-align:center;
position:relative;
padding: 4px 10px 4px 10px;
margin-right:0px;
margin-top:7px;
border:none;
}
#menu li:hover {
padding: 4px 9px 4px 9px;*/
}
.dropdown_1column,
.dropdown_2columns,
.dropdown_3columns,
{
background:url("img/blue-arrow.png") no-repeat center 0px z-index;
margin:10px auto;
float:left;
display: inline-block;
position:absolute;
left:-999em; /* Hides the drop down */
text-align:center;
padding:10px 5px 10px 5px;
border-left:1px solid #e5edf4;
border-right:1px solid #e5edf4;
border-top:3px solid #004b91;
border-bottom:3px solid #e5edf4;
}
.dropdown_1column {width: 260px;}
.dropdown_2columns {width: 520px;}
.dropdown_3columns {width: 780px;}
#menu li:hover .dropdown_1column,
#menu li:hover .dropdown_2columns,
#menu li:hover .dropdown_3columns,
{
left:-1px;
top:auto;
}
.col_1,
.col_2,
.col_3,
{
display:inline;
float: left;
position: relative;
margin-left: 5px;
margin-right: 5px;
}
.col_1 {width:250px;}
.col_2 {width:500px;}
.col_3 {width:750px;}
Any CSS guru's out there care to send some advise?
In the example posted you can move the boxes by changing
#menu li:hover .dropdown_1column, #menu li:hover .dropdown_2columns, #menu li:hover .dropdown_3columns, #menu li:hover .dropdown_4columns, #menu li:hover .dropdown_5columns
{
left: -212px; /*for column 4*/
}
Of course you would have to have a static width for each box and style them accordingly.
I have a CSS drop down menu that drops up instead of down. What could be wrong? here is the code and the aspx tags related to the problem. this is inside the master page; also on the pages inside ContentPlaceHolder1 eveything inside tags!
.wrapper {
position:relative; height:25px;
}
.mainmenu {
z-index:100;
font-family:Verdana, Geneva, sans-serif;
font-weight:normal;
font-size:90%;
line-height:25px;
left:50%;
margin-left:-303px;
width:606px;
}
ul.menu {
padding:0;
margin:0;
list-style:none;
width:100px;
overflow:hidden;
float:left;
margin-right:1px;
}
ul.menu a {
text-decoration:none;
color:#fff;
padding-left:5px;
position:absolute;
}
ul.menu li.list {
float:left;
width:250px;
margin:-32767px -125px 0px 0px;
background:url(images/top1.png) no-repeat left bottom;
}
ul.menu li.list a.category {
position:absolute;
z-index:50;
display:block;
float:left;
width:120px;
margin-top:32767px;
background:transparent;
}
ul.menu li.list a.category:hover,
ul.menu li.list a.category:focus,
ul.menu li.list a.category:active {
margin-right:1px;
background-image:url(images/tophover1.png);
background-repeat:no-repeat;
background-position:left top;
}
ul.submenu {
float:left;
padding:25px 0px 0px 0px;
margin:0;
list-style:none;
background-image:url(images/tophover1.png);
background-repeat:no-repeat;
background-position:left top;
margin:-25px 0px 0px 0px;
}
ul.submenu li a {
float:left;
width:120px;
background:#369;
clear:left;
}
ul.submenu li a.endlist {
background:url(images/bottom1.png);
}
ul.submenu li a.endlist:hover,
ul.submenu li a.endlist:focus,
ul.submenu li a.endlist:active {
background:url(images/bottomhover1.png);
}
ul.submenu a:hover,
ul.submenu a:focus,
ul.submenu a:active {
background:#900;
margin-right:1px;
}
// and here is the portion of aspx
<div id="slidemenu" >
<ul id="nav">
<li>Home</li>
<li>History</li>
<li>....</li>
<li>Careers</li>
<li>Contact</li>
<li><span> ... </span> </li>
<li class="list">
<a class="category" href="....aspx"> ... </a>
<ul class="submenu" >
<li>1st drop down menu</li>
<li>2nd drop down menu</li>
</ul>
</li>
</ul>
</div>
<!-- ------------ -->
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
Apply this css to your menu text blocks:
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
You should post some code, but I wrote something that may help:
see it in action:
http://jsfiddle.net/HE8uj/
pasted code:
<div class="menu">
<em>hover me!</em>
<ul>
<li> item one </li>
<li> item two </li>
<li> item three </li>
</ul>
</div>
.menu {
font-size: 12px;
width: 100px;
background: #eee;
border: solid 1px black;
margin:1px;
height:20px;
position:relative;
}
.menu * {
display:block;
padding:0; margin:0;
}
.menu em {
padding:5px;
}
.menu ul {
display:none;
}
.menu:hover ul {
display:block;
position:absolute;
width:100%;
bottom:100%; /* change to TOP and it will drop down */
border:solid 1px black;
background: #fff;
}
.menu li {
padding:5px;
}