I have a menu bar..it appears correctly(horizontal) in mozilla and chrome but appears vertical in IE8.
how can i make it horizontal using css
here is the html code
<div id="navigation">
<div id="myjquerymenu" class="jquerycssmenu">
<br/>
<ul>
<li class="txtfont">Manage Image</li>
<li class="txtfont">Manage Menu
<ul>
<li class="txtfont">Manage Parent Menu</li>
<li class="txtfont">Manage Sub Menu</li>
<li class="txtfont">Manage Sub Sub Menu</li>
</ul>
</li>
<li class="txtfont">Manage Content
<ul>
<li class="txtfont">Main Content</li>
<li class="txtfont">News</li>
<li class="txtfont">Announcements</li>
</ul>
</li>
<li class="txtfont">Manage FAQ</li>
<li class="txtfont">Manage Settings</li>
<li>Log Out</li>
</ul>
</div>
</div>
The css code is as below:
#navigation { height: 80px; width:200%; position: relative; padding-top:10px; padding-left:200px; float:none; font-size:12px; font-family: "Century Gothic"; font-weight:bold; }
.jquerycssmenu{
font-size:12px;
font-family: "Trebuchet MS", "sans-serif";
/*padding-left: 0px; offset of tabs relative to browser left edge*/
margin-top:25px;
color:#FFFFFF;
font-weight:normal;
border:#000000;
}
.jquerycssmenu ul{
margin: 0;
padding: 0;
list-style-type: none;
}
/*Top level list items*/
.jquerycssmenu ul li{
position: relative;
display: inline;
float: left;
border-bottom-color:#000000;
}
/*Top level menu link items style*/
.jquerycssmenu ul li a{
display: block;
padding: 6px 7px 6px 7px;
min-width:70px;
margin-right: 6px; /*spacing between tabs*/
border: 1px solid #000000;
border-bottom-width: 1;
color:#FFFFFF;
text-decoration: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background-color:#330066;
/*background-color:#99CC00;*/
text-align:center;
/*background: url(../../images/admin/images/menu_bg.jpg);*/
background-color:#330066;
behavior: url(border-radius.htc);
}
.jquerycssmenu ul li a:hover{
background:#663399;
}
/*1st sub level menu*/
.jquerycssmenu ul li ul{
position: absolute;
left: 0;
display: block;
visibility: hidden;
padding-top:0px;
}
/*Sub level menu list items (undo style from Top level List Items)*/
.jquerycssmenu ul li ul li{
display: list-item;
float: none;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
font-family: "Trebuchet MS", "sans-serif";
}
/*All subsequent sub menu levels vertical offset after 1st level sub menu */
.jquerycssmenu ul li ul li ul{
top: 0;
display: list-item;
float: none;
font-family: "Trebuchet MS", "sans-serif";
}
/* Sub level menu links style */
.jquerycssmenu ul li ul li a{
font-family:"Trebuchet MS", "sans-serif";
font-size:13px;
font-weight:normal;
width: 160px; /*width of sub menus*/
background-color:#330066;
color:#FFFFFF;
padding: 6px 5px;
margin: 0;
border-top-width: 1;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 1px;
}
.jquerycssmenu ul li ul li a:hover{ /*sub menus hover style*/
background:#663399;
color: #ccc;
}
Since there is no code to analyze at this point in time, here are my thoughts...
If you're using display: inline-block; I know this doesn't work in IE7. However, it should work in IE8, FF, Chrome.
You may want to try float: left; on the menu items to see if that fixes your problem.
Your problem as described is not evident in IE8.. for me in IE8 using the code as posted (adding the missing closing tags and another menu level) the menu is horizontal
however I've tidied up the code as there was a large horizontal scroll in all browsers and "sticky" hover bugs in IE7 so maybe there's a difference somewhere, that will fix IE8 for you too
Example Fiddle : here
This works (as in it looks the same, I'm not sure if it's your exact intention) - in all browsers tested in
Related
If you reduce my test page here: http://www.linestop.com/Linestop2015/index.php
To display the mobile dropdown menu you will notice that not all my submenu items are displaying. How can I fix this? Can you help me?
Here is my CSS
#navigation { padding:0 21px; margin-bottom: 0; }
.sf-menu{
margin-bottom: 0;
}
.top-nav,.sf-menu li{
background: transparent;
}
.sf-arrows .sf-with-ul:after{
border-top-color: #ff9000;
}
.sf-menu ul li,.sf-menu ul ul li,.sf-menu ul ul ul li {
background: #fff;
}
.sf-menu li:hover, .sf-menu li.sfHover {
background: #ff9000;
}
.sf-menu a{
color: #070707;
border:none;
font-family: 'Open Sans', sans-serif;
text-transform: uppercase;
font-size: 1.2em;
padding-left: 2em;
padding-right: 2em;
}
.small-top-menu{
display: none
}
.small-top-menu select{
padding: 5px;
background: #68ceef;
font-family: 'Open Sans', sans-serif;
text-transform: uppercase;
border:5px solid #fff;
margin: 10px 0;
}
.small-top-menu select option{
padding: 10px;
}
#navigation ul li a { color: #4a4a4a; padding: 0 7px; display:block; height: 21px; line-height: 21px; border: 2px solid transparent; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -o-border-radius: 3px; width:100% }
#navigation ul li.active a,
#navigation ul li a:hover { border: 2px solid #029cdb; background: url(images/nav-btn.png) repeat-x 0 0; color:#fff; text-decoration: none; }
#navigation a.nav-btn { display:none; }
Here is my mobile menu css
#navigation { position:relative; z-index: 100; padding:0 0px; margin:0 10px; }
#navigation a.nav-btn { margin-bottom: 15px; text-decoration: none; padding:0 36px 0 10px; line-height:30px; display:block; background: url(images/navigation.png) repeat-x 0 0; height: 30px; position: relative; }
#navigation a.nav-btn span { background: url(images/dd-nav-arrs.png) no-repeat 0 bottom; width: 20px; height: 15px; position:absolute; top: 8px; right: 12px; }
#navigation a.nav-btn.active span { background-position:0 0; }
#navigation ul { display:none; position: absolute; top: 30px; left: 0; width: 100%; }
#navigation ul li { float:none; height: 30px; border-top: 1px solid #fff; display:block; padding:0 0 0 0; background: url(images/navigation.png) repeat-x 0 0; }
#navigation ul li a { border: 0; line-height:30px; float:none; height: 30px; display: block; font-size: 14px; padding-left: 20px; padding-right: 20px; width:100%; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; -o-border-radius: 0px; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; }
#navigation ul li a:hover { background-image:url(images/blue-btn.png); border:0; }
#navigation ul li.active span { background: transparent; border:0; }
#navigation ul li.first { display:block; }
Here is my html code
<nav id="navigation"> HOME<span></span>
<section>
<ul class="sf-menu large-12">
<li class="active">Home</li>
<li class="has-dropdown">Services
<ul class="dropdown">
<li class="has-dropdown">Hottap Services
<ul class="dropdown">
<li>Hottap Free Quote</li>
</ul>
</li>
<li>Linestop Services
<ul class="dropdown">
<li>Linestop Free Quote</li>
</ul></li>
<li>Valve Installations Services
<ul class="dropdown">
<li>Valve Install Free Quote</li>
</ul></li>
<li>Pipeline Bypass Services
<ul class="dropdown">
<li>Pipe Bypass Free Quote</li>
</ul></li>
</ul>
</li>
<li class="has-dropdown">Line Stop Equipment
<ul class="dropdown">
<li class="has-dropdown">Hottap Machines
<ul class="dropdown">
<li>Small Machines</li>
<li>Large Machines</li>
</ul>
</li>
<li>Linestop Machines
<ul class="dropdown">
<li>QualTech QT Linestop Machines</li>
<li>IFT Soft Stop 100</li>
<li>IFT Top Pivot Stop 1000</li>
<li>IFT Folding Heads</li>
</ul></li>
<li>Hottap / Linestop Fittings
<ul class="dropdown">
<li>IFT 499 Fittings Copper, Steel & PVC</li>
<li>IFT Mechanical Joint Fittings</li>
<li>IFT Stainless Steel Hottap Linestop Fittings</li>
<li>IFT On-Size Folder Weld Type Fittings</li>
<li>IFT 400 Series Fittings CMLC</li>
<li>IFT 500 Series Fittings CMLC</li>
<li>AWWA - Fittings</li>
<li>Flanged Steel Knife Gate Valves</li>
<li>Completion Plug Assemblies</li>
</ul></li>
<li>All 2.5"-54.6" Linestop™ Cups</li>
</ul>
</li>
<li class="has-dropdown">About us
<ul class="dropdown">
<li>Contact Us</li>
<li>Customers</li>
<li>Location</li>
<li>Job Application</li>
<li>Online Flip Catalog</li>
<li>Facebook Fan Page</li>
</ul>
</li>
<li>Featured Jobs</li>
</ul>
</section>
<div class="cl"> </div>
</nav>
Thanks, Jesse
Look at the #navigation ul styling, the position: absolute; property should only be applied to the first UL ('.sf-menu'). Also check the .sf-menu ul styling, it should have an absolute position. And remove the height from #navigation ul li, because some li items have sub menus but you can't see them because the height is only 30px.
I figured out the answer to my issue. trying to make the menu too complex there were no easy fixes. So i had to go back to the original code and just use the mobile menu for the main navigation menu. Seems to work fine... Thanks for for the help!
I've coded a css dropdown menu and cant seem to get the name "LOGOS" to stay within the green box when I hover over the word "Illustration". I've made the word 5em so I can see it. Cant get it to stay in the box...no control of it's position. Can you help?
Thanks,
T.
<div id="nav-bar-sm-cont">
<ul id="sm-nav">
<li id="home">HOME</li>
<li id="about">PROFILE</li>
<li id="illustration">ILLUSTRATION
<ul>
<li id="logos">LOGOS</li>
</ul>
</li>
<li id="billboards">BILLBOARDS</li>
<li id="six-mo">6 MO BREAKFAST</li>
<li id="cal">ARTSHOW</li>
<li id="church">CHURCH</li>
<li id="contact">CONTACT</li>
<li id="cat-ill">CAT ILLUSTRATION</li>
<li id="contact-cat">CONTACT CAT</li>
</ul>
</div>
<!--end nav bar sm container -->
/* START small NAV bar **************************/
#nav-bar-sm-cont { position: absolute;
width: 1000px;
height: 100px;
}
#sm-nav li { position: relative;
top: 30px;
left: 35px;
font-size: .6em;
line-height: 250%;
letter-spacing: 0.3em;
list-style-type: none;
float: left;
}
#sm-nav a:link{ text-decoration:none;
color:silver;
background-color:transparent;
padding: 5px 5px;
}
#sm-nav a:visited {text-decoration:none;
color: #9781B7;
padding: 5px 5px;
background-color: transparent;
}
#sm-nav a:hover {text-decoration:none;
color: #fff;
background-color:#a7d6d5;
padding: 5px 5px;
}
#sm-nav a:active {text-decoration:none;
color:#fff;
background-color: green;
padding: 5px 5px;
}
/*start drop down************************************/
#sm-nav li ul { position:relative;
list-style-type: none;
display: none;
}
#sm-nav li:hover ul { position: absolute;
background: green;
padding: 5px 5px;
display:block;
font-size: 5em;
width: 103px;
height: 10px;
}
/*end drop down*****************************************/
/* END small NAV BAR *****************************/
The problem is that your CSS for the li is affecting both the parent li and the child. To fix that just change:
#sm-nav li {
to
#sm-nav > li {
Now that CSS will only affect the parent li and you're free to adjust the CSS for the child however you want like this:
#sm-nav li:hover ul li { }
JSFiddle
I am working on a site for my brother's new plumbing company, and I am having two issues with my navigation menu. I copied some CSS from a tutorial site and tried altering it to my taste, but I can't figure out why this is happening. When I hover over the top-level menu item ("Services" in this case), the sub-menu appears as it should, but the background of the LI's extend outside of the screen. I have tried changing/setting widths on different areas of the CSS, but my limited knowledge has me scratching my head bald. I have a temporary site up, but I am testing this new version with Media Queries locally.
It won't let me post a screenshot without 10 reputation, so here is a link: http://www.sourceplumbing.com/Capture.png
The HTML:
<nav>
<ul>
<li>About Us</li>
<li>Services
<ul>
<li>Leak Detection</li>
<li>Water Heaters</li>
<li>Plumbing Fixtures</li>
</ul>
</li>
<li>Reviews</li>
<li>Contact Us</li>
</ul>
</nav>
The CSS:
nav ul li:hover > ul {
display: block;
}
nav ul {
width:100%;
height:auto;
min-width:550px;
background: -webkit-linear-gradient(#d5d5d5, #595959); /* For Safari */
background: -o-linear-gradient(#d5d5d5, #595959); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#d5d5d5, #595959); /* For Firefox 3.6 to 15 */
background: linear-gradient(#d5d5d5, #595959); /* Standard syntax */
-webkit-border-radius: 25px;
-o-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
font-size: 16px;
font-family: "Times New Roman", Times, serif;
font-weight: bold;
text-align: center;
text-shadow: 2px 2px 2px #cccccc;
text-decoration:none;
list-style: none;
position: relative;
display: table;
}
nav a:link, a:visited {
text-decoration: none;
color: #000000;
padding: 8px 0px 8px 8px;
}
nav ul:after {
content: "";
clear:both;
display: block;
}
nav ul li {
display:inline-block;
width:auto;
}
nav ul li:hover a {
text-decoration:none;
color: #fff;
}
nav ul li a:link, a:visited {
display: block;
padding: 5px;
color:#000;
text-decoration: none;
}
nav ul ul {
background: #999;
border-radius: 0px;
padding: 0;
position: absolute;
width:150px;
}
nav ul ul li {
width:150px;
border-top: 1px solid #ccc;
position: relative;
display:block;
}
nav ul ul li a {
width:150px;
padding: 5px;
text-align:left;
color:#000;
display:block;
}
nav ul ul li a:hover {
color:#FFF;
}
I do have another issue, but if I can get this figured out, I will move onto that one next. I would appreciate any help you can offer!
What you are looking for is min-width: 550px;. This is causing ALL <ul> to expand to a min width of 550px.
Taking this out will fix the problem. I guess that was there for the nav to stop it getting to small, in that case you should be about to put that under nav and not nav ul.
DEMO HERE
Putting the min-width in the right place:
nav {
min-width: 550px;
}
DEMO HERE
I have a navcontainer with buttons in the container. I need to make a dropdown list for only one of the buttons. How would this be accomplished with CSS/HTML. Here is my code:
HTML:
<div id="navcontainer">
About Us
Request a Quote
Affiliates
Pricing & Plans
Additional Services
Service Details
Watering
</div>
CSS:
#navcontainer {
float: right;
width: 1040px;
height: 45px;
text-align: center;
line-height: 45px;
color: #fff;
margin-bottom: 6px;
}
.button {
text-align: center;
background: #226426;
color: #fff;
width: 100px;
height: 45px;
float: left;
text-decoration: none;
font-family: Arial, sans-serif;
font-size: 15px;
font-weight: bold;
border-right: solid 1px #91b293;
border-top: solid 1px #91b293;
border-bottom: solid 1px #91b293;
}
Do I need to make this into a ul or can I keep it as is, and just add a dropdown to the Services button? Thanks for your help.
As a general rule, it's always a good idea to have your navigation in a list, it helps keep your options open to a multidimensional menu system at any point. Here is what I would do:
HTML
<ul id="nav">
<li>link 1</li>
<li>link 2
<ul>
<li>sublink 1</li>
<li>sublink 2</li>
</ul>
</li>
<li>link 3</li>
</ul>
CSS
#nav, #nav ul {list-style: none; margin: 0; padding: 0;}
#nav li {position: relative;}
#nav li ul {position: absolute; top: 100%; left: 0; display: none;}
#nav li:hover ul {display: block;}
jQuery - optional
This is if you wanted some sort of effect on the
function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
$(this).find('ul:first').css({visibility: "visible",display: none"}).show(800);
},function(){
$(this).find('ul:first').css({visibility: "hidden"});
});
}
Hope this helps.
I have been struggling with this code for quite a few hours now and I have been unable to fix it. This is my CSS for my horizontal navigation:
#topmenu {
position: relative;
width: 690px;
left: 270px;
top: 11px;
}
#nav {
padding: 0px;
margin: 0px;
float: left;
}
#nav li {
float: left;
position: relative;
list-style: none;
margin: 0px;
margin-right: 6px;
}
#nav li ul {
display: none;
margin: -1em 0 0 -3em;
padding: 1em;
padding-top: 1.2em;
position: absolute;
top: 24px;
z-index: 500;
opacity: 0.96;
ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=96)";
filter: alpha(opacity=96);
}
#nav li:hover ul {
display: block;
}
#nav li ul li {
display: block;
clear: both;
}
#nav li ul li a {
border-radius: 0px;
width: 125px;
font-size: 11px;
padding-left: 25px;
padding-right: 0px;
padding-bottom: 5px;
}
#nav li ul li span {
float: left;
color: #FFF;
font-size: 14px;
text-decoration: none;
font-weight: bold;
display: block;
background: #6AC1F3;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 0px;
width: 145px;
}
#nav a {
float: left;
color: #FFF;
font-size: 13px;
text-decoration: none;
display: block;
background: #6AC1F3;
padding: 5px 25px 5px 25px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
-moz-border-top-left-radius: 10px;
-moz-border-top-right-radius: 10px;
-webkit-top-left-radius: 10px;
-webkit-top-right-radius: 10px;
}
#nav a:hover, #nav a.selected {
background-color: #FEA14F;
}
And this is my HTML code:
<div id="topmenu">
<ul id="nav">
<li><a class="rounded" href="index.html">Home</a></li>
<li><a class="rounded" href="about-us.htm">About Us</a></li>
<li><a class="rounded" href="contact.htm">Contact</a></li>
<li><a class="rounded" href="#">Services</a>
<ul>
<li><span>Manage</span></li>
<li>IT Management</li>
<li>Helpdesk Support</li>
<li>Planning and Consulting</li>
<li><span>Instruct</span></li>
<li>Software Training</li>
<li>Custom Curriculum</li>
<li>Social Networking</li>
<li><span>Grow</span></li>
<li>Website Design</li>
<li>Website Optimization</li>
<li>Internet Marketing</li>
<li><span>Secure</span></li>
<li>Remote Back Up</li>
<li>Scanning and Storage</li>
<li>Spam and Virus Protection</li>
</ul>
</li>
<li><a class="rounded" href="products.htm">Products</a></li>
<li><a class="rounded" href="real-estate-solutions.htm">Real Estate Solutions</a></li>
</ul>
</div>
The code works in Firefox, Chrome, but I am unable to make it work for IE. I have created additional rules for IE:
body {
behavior: url(csshover.htc);
}
#topmenu {
font-size: 100%;
}
#menu ul li {float: left; width: 100%;}
#menu ul li a {height: 1%;}
But all the menu does is display the drop-down, but when I try to select an item in the drop-down menu, the menu disappears.
What's the issue?
I see that you've mostly figured this out. You can use a semi transparent png to get the 96% opacity effect.
Alternatively you can use jquery's opacity, which i think is cross browser...
from my experience removing the filter isn't enough. the main problem is that IE li's don't extend to create one uninterrupted sequence, thus leaving empty spaces which aren't covered by the :hover rule, consequently causing the sub-menu to disappear.
the solution is to add a background color or image to the submenu's li and the triggering top menu li, in order to create a continuous sequence of li elements, with no spaces. (transparent background color won't work). if you don't want a background color applied simply add a 1pxX1px transparent PNG background image instead.
hope you find this helpful.