I for whatever reason cannot get rid of the gap between my header and the nav bar menu. I've tried every adjustment of padding/margins I can think of to either push it up or move the bar, but it just does funky stuff with the menu or pushes other content up. I need some help.
and the code
#header_wrap {
width:100%;
height:144px;
text-align: center;
}
#header {
width:980px;
margin:0 auto;
}
#preloadedImages
{
width: 0px;
height: 0px;
display: none;
background-image:url(Logo/logo14hover.gif);
}
.site_logo {
float:left;
width:302px;
height:144px;
background:url(Logo/logo14.gif) no-repeat;
}
.site_logo:hover {
float:left;
width:302px;
height:144px;
background:url(Logo/logo14hover.gif) no-repeat;
}
.headerpic {
float:left;
width:678px;
height:144px;
background:url(Images/headerpic.gif) no-repeat;
}
#menu_wrap {
position:relative;
z-index:2;
text-align:center;
width:100%;
padding: 0px 0px;
}
#menu {
position:relative;
z-index:2;
width:1000px;
text-align:center;
margin:0 auto;
height:61px;
padding: 0px 0px;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #bbb38f; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2JiYjM4ZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2YjY0NDEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #bbb38f 0%, #6b6441 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#bbb38f), color-stop(100%,#6b6441)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #bbb38f 0%,#6b6441 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #bbb38f 0%,#6b6441 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #bbb38f 0%,#6b6441 100%); /* IE10+ */
background: linear-gradient(to bottom, #bbb38f 0%,#6b6441 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bbb38f', endColorstr='#6b6441',GradientType=0 ); /* IE6-8 */
box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
padding: 0px 0px;
list-style:none;
position: relative;
display:inline-table;
text-decoration:none;
font-family:Copperplate Gothic Light,Georgia, Palatino, Times New Roman, serif;
font-size:17px;
color:#FFFFFF;
font-weight:light;
outline:none;
text-shadow: 1px 1px #000000;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: #736e57;
background: linear-gradient(top, #BBB38F 0%, #6B6441 40%);
background: -moz-linear-gradient(top, #BBB38F4 0%, #6B64415 40%);
background: -webkit-linear-gradient(top, #BBB38F 0%,#6B6441 40%);
text-decoration:none;
font-family:Copperplate Gothic Light,Georgia, Palatino, Times New Roman, serif;
font-size:17px;
color:#FFFFFF;
font-weight:light;
outline:none;
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
}
nav ul li:hover a {
color:#FFFFFF;
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
}
nav ul li a {
color:#FFFFFF;
display: block;
padding: 12px 42px;
text-decoration:none;
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
}
nav ul li:hover > ul {
background: #303030;
text-decoration:none;
display: block;
}
nav ul ul {
background: #303030;
font-family: Helvetica, Copperplate Gothic Light, Arial, sans-serif;
font-size:14px;
text-decoration:none;
color:#000;
font-weight:light;
outline:none;
filter:alpha(opacity=95);
opacity: 0.95;
-moz-opacity:0.95;
}
nav ul ul li {
text-decoration:none;
float: none;
position: relative;
}
nav ul ul li a {
text-decoration:none;
padding: 0px 0px;
color:#000;
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
}
nav ul ul li a:hover {
text-decoration:none;
background: #736e57;
text-shadow: 1px 1px #000000;
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
}
nav ul ul {
text-decoration:none;
padding: 0px;
position: absolute;
}
nav ul ul li {
float: none;
position: relative;
}
nav ul ul li a {
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
padding: 10px 40px 10px 15px;
color:#000;
font-family: Helvetica, Copperplate Gothic Light, Arial, sans-serif;
font-size:15px;
text-align: left;
}
nav ul ul li a:hover {
font-family: Helvetica, Copperplate Gothic Light, Arial, sans-serif;
font-size:15px;
background: #6B6441;
text-align: left;
background: #bbb38f; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2JiYjM4ZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2YjY0NDEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #bbb38f 0%, #6b6441 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#bbb38f), color-stop(100%,#6b6441)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #bbb38f 0%,#6b6441 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #bbb38f 0%,#6b6441 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #bbb38f 0%,#6b6441 100%); /* IE10+ */
background: linear-gradient(to bottom, #bbb38f 0%,#6b6441 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bbb38f', endColorstr='#6b6441',GradientType=0 ); /* IE6-8 */
filter:alpha(opacity=100);
opacity: 1;
-moz-opacity:1;
}
nav ul ul ul {
position: absolute;
left: 100%; top:0;
}
and the HTML
<div align="center" id="header_wrap">
<div id="header">
<div id="preloadedImages"></div><div class="site_logo"></div>
<div class="headerpic"></div>
</div>
</div>
<!-- START MENU NAV BAR CODE -->
<div id="menu_wrap">
<div id="menu">
<nav>
<ul>
<li>Company
<ul>
<li>Mission</li>
<li>Philosophy</li>
</ul>
</li>
<li>Solutions
<ul>
<li>Q Pipe Estimator
<ul>
<li>Advantage</li>
<li>Differentiator</li>
<li>Features</li>
<li>Screen Shots</li>
</ul>
</ul>
</li>
</li>
<li>Services
<ul>
<li>Technical Support</li>
<li>Training</li>
<li>Customization</li>
<li>FAQ's</li>
</ul>
</li>
<li>Industry
<ul>
<li>Focus</li>
<li>Customers</li>
</ul>
</li>
<li>Contact
<ul>
<li>Contact Information</li>
<li>Request Information</li>
</ul>
</li>
<li>Login
</li>
</ul>
</nav>
</div>
</div>
<!-- END MENU NAV BAR CODE -->
added fiddle link in comments
Simply remove the default margin for your main ul (the direct descendant of nav)
Select it using the following CSS, or giving that specific ul a class or id (this way you target only the ul causing you trouble).
nav > ul {margin: 0}
I stuck it into the top of your fiddle, and updated it here
I realise this has now been answered because I took way too long formatting this, but I'd just like to point out that it has nothing to do with the box-shadow which has no impact on positioning.
The ul default margin is responsible for this space. Try setting margin-top:0 to nav ul. Demo: http://jsfiddle.net/xtsAx/8/
for me the error was because i used dream weaver to edit my code.
this give me a hiccup by adding default headers.
when i removed those headers and just gave<html> <head>...<?php>....?> .... </html> it worked perfect.
always remove html tags and header by dream weaver.
**Update: I had the same error again in Firefox so i applied
*{
margin:0;
padding:0;
}
And hence got rid of it completely now.
**
Related
I am working on a menu that looks like this:
<nav>
<ul>
<li>Home</li>
<li>Expenses
<ul>
<li>View My Expenses</li>
<li>View Expenses</li>
<li> View Deconts
<ul>
<li>Single Deconts</li>
<li>View All Deconts</li>
</ul>
</li>
<li> Add Expenses
<ul>
<li>Soccer/Tennis Expenses</li>
<li>Gym Expenses</li>
<li>Coffee/Tea Expense</li>
</ul>
</li>
</li>
</ul>
It works perfectly on chrome and firefox, it does not work on IE.
The navigation CSS looks something like this:
nav {
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
z-index: 9999;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 10px 40px;
color: #757575; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a; position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
Am I using deprecated functions ? I know the -moz- tag works for Mozilla Firefox and the -webkit- works for Chrome, but it initially worked. I must have updated IE or something. I am using IE 9.
Two things I noticed.
1.) Your code looks fine except for the lack of an ending tag. This could have been a copy paste issue.
2.) IE8 and prior do not work with the nav tag. So have you verified that you are running in IE9 mode? Open developer tools to make sure (F12) in IE. Make sure both document and browser mode are not in compability mode and set to IE9 or whatever your current version is at the moment.
Since I am discovering and struggling with CSS dropdown menus, I hope you won´t mind this simple question. I have a fully functioning CSS dropdown menu, but just after I prevented the horizontal menu from wrapping (in case the browser would be resized), I am having trouble displaying the dropdown items below each other (block). Instead they are now also displayed next to each other (inline-block).
Can anybody tell me which line I have to add? This was the code that I added that changed both my menu from wrapping (good) and my dropdown items from being displayed below each other:
nav ul li {
display: inline-block;
float: none;
}
Full CSS menu code:
/* Set general properties for main menu items */
nav ul {
background: linear-gradient(to bottom, rgba(200,220,154,0) 30%, #c8dc9a 90%);
background: -moz-linear-gradient(top, rgba(200,220,154,0) 30%, #c8dc9a 90%);
background: -webkit-linear-gradient(top, rgba(200,220,154,0) 30%, #c8dc9a 90%);
background: -ms-linear-gradient(top, rgba(200,220,154,0) 30%, #c8dc9a 90%);
background: -o-linear-gradient(top, rgba(200,220,154,0) 30%, #c8dc9a 90%);
padding: 0;
margin: 0;
font-size: 16px;
white-space: nowrap;
list-style: none;
position: relative;
text-align: left;
}
nav ul:after {
content: "";
clear: both;
display: block;
}
nav ul li {
display: inline-block;
float: none;
border-bottom: 3px solid #244612;
padding:0 0 0 7px;
}
/* Set hover properties for main menu items */
nav ul li:hover {
background: #e29a0e;
background: linear-gradient(to bottom, rgba(226,154,14,0) 0%, #e29a0e 100%);
background: -moz-linear-gradient(top, rgba(226,154,14,0) 0%, #e29a0e 100%);
background: -webkit-linear-gradient(top, rgba(226,154,14,0) 0%, #e29a0e 100%);
background: -ms-linear-gradient(top, rgba(226,154,14,0) 0%, #e29a0e 100%);
background: -o-linear-gradient(top, rgba(226,154,14,0) 0%, #e29a0e 100%);
}
nav ul li:hover a {
color: #ffffff;
}
nav ul li:hover ul li a{
color: #757575;
}
nav ul li a {
display: block;
padding: 10px 13px;
color: #757575;
text-decoration: none;
}
/* Set properties for hiding/unhiding dropdown items */
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
/* Set general properties for dropdown menu items */
nav ul ul {
background: #F7F7F7;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
margin-left: -7px;
font-size: 14px;
white-space: normal;
float: left;
}
/* Set hover properties for dropdown menu items */
nav ul ul li {
border-top: 1px solid #C9CCCF;
border-bottom: 0px solid #C9CCCF;
position: relative;
padding: 0;
}
nav ul ul li a {
padding: 10px 25px;
}
nav ul li:hover ul li a:hover {
background: #e29a0e;
color: #ffffff;
}
I hope that I understood your question correctly!
Here's a fiddle.
All you need to add is
nav ul li ul li{
display:block;
}
And that should be it!
I have a tabular navigation list (with the styles I choose for) in an external file contains the following code:
.tabs
{
position:relative;
text-align:left; /* This is only if you want the tab items at the center */
width: 90%;
padding: 0;
margin: 0;
/*border: 1px solid green;*/
}
.tabs ul.menu
{
list-style-type:none;
display:block; /* Change this to block or inline for non-center alignment */
width:570px;
/* min-width:570px;
max-width:800px;
vertical-align: bottom;
/*border: 1px solid red;*/
}
.tabs ul.menu > li
{
display:inline;
float:center;
vertical-align: bottom;
/** border: 1px solid yellow;*/
cursor:hand;
}
.tabs ul.menu li > a
{
color:#7a7883;
text-decoration:none;
display:inline-block;
text-align:center;
border:1px solid #f1f3f4;
padding:5px 10px 5px 10px;
width: 25%;
font-size:15px;
font-family:"Times New Roman", Times, serif;
border-top-left-radius:5px; -moz-border-radius-topleft:4px; -webkit-border-top-left-radius:5px;
border-top-right-radius:5px; -moz-border-radius-topright:4px; -webkit-border-top-right-radius:5px;
-moz-user-select:none;
cursor:hand;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#aeb8c0));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #aeb8c0, #fff);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #aeb8c0, #fff);
/* IE 10 */
background: -ms-linear-gradient(top, #aeb8c0, #fff);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #aeb8c0, #fff);
}
.tabs ul.menu li > a:hover
{
color: #fff;
cursor:hand;
}
.tabs ul.menu li > div
{
display:none;
position:absolute;
width:98%;
/* max-width:700px;*/
min-height:230px;
left:0;
margin: 0 15px 0 15px;
z-index:-1;
text-align:left;
padding:0;
}
.tabs ul.menu li > div > p
{
border:1px solid #f1f3f4;
background-color: #f5f9fc;
width: 99%;
padding:10px;
margin:0;
color: #65636e;
font-size:12px;
font-family:"Times New Roman", Times, serif;
text-decoration: none;
min-height:200px;
}
.tabs ul.menu li > a:focus
{
color: #f5f9fc;
}
.tabs ul.menu li:target > a
{
cursor:default;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f1f3f4), to(#fff));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #fff, #f1f3f4);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #fff, #f1f3f4);
/* IE 10 */
background: -ms-linear-gradient(top, #fff, #f1f3f4);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #fff, #f1f3f4);
cursor:hand;
}
.tabs ul.menu li:target > div
{
display:block;
}
and in the web page I have this:
<!-- Side NAVIGATION -->
<!-- Wrapper 2-Content -->
<div class="wrapper" style="min-height: 200px;"">
<!-- content -->
<div class="content">
<div class="tabs">
<ul class="menu">
<li id="item-1">
Bla Bla 1
<div><p>Tab Content 1</p></div>
</li>
<li id="item-2">
Bla Bla 2
<div><p>Tab Content 2</p></div>
</li>
<li id="item-3">
Bla Bla 3
<div><p>Tab Content 3</p></div>
</li>
</ul>
</div>
</div>
<!-- content -->
<!-- end of Side NAVIGATION -->
All goes fine except that it displays the tabs only without the box where the content should appear. I want one of the contents to be visible as default. I just don't know how to activated it without using javaScript.
Thank you in advanced.
add display : block as style for the div which u want to display by default. For example see this fiddle I hv created for making item1 visible on run http://jsfiddle.net/X6Agf/
<div style="display:block"><p>Tab Content 1</p></div>
I am soooo confused! Here is the site I'm developing: Cancer Support site
I seem to have two problems... that I have spent hours and hours trying to figure out the solution.. so I really hope someone can help.
Problem 1: I use an ID=navactive to keep the parent menu item active if it is the current page being diplayed. That works. However, the way I have coded the CSS, it has introduced an error by making the submenu items appear active when they first appear upon mousever of an ID=navactive parent. Instead the submenu items should initially appear as inactive until they are actually moused over. On the site, you can see that the "Home" page is the active page on the parent menu. If you mouse over it, the two children submenus appear.. but they show up active. They should appear as inactive - the same way as the submenus do when you mouse over the "Our Work" parent menu item.
Problem 2: None of my grandchildren submenu items appear at all.. Under both the "Home" and "Our Work" parent menu items I have the following configuration:
Top level menu (parent)
Submenu 1 (child 1)
Submenu 2 (grandchild 1)
Submenu 3 (child 2)
Instead it appears on the page like this where the grandchild 1 becomes the child 2, and no grandchildren are viewable (and the original child 2 [submenu 3] is missing):
Top level menu (parent)
Submenu 1 (child 1)
Submenu 2 (child 2)
Any suggestions would be greatly appreciated!!!
Thanks!
For your convenience.. here is my css code for the nav menu section:
#navcontainer
{
width: 711px;
height: 25px;
text-align: center;
margin: 0px auto; /*Center container on page*/
clear: both;
background-color: #129F9F;
border: 3px solid #FFFFFF;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
-ms-border-radius: 5px;
border-radius: 5px;
/* IE10 Consumer Preview */
background-image: -ms-linear-gradient(top, #16ACAC 0%, #0D6F6F 100%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(top, #16ACAC 0%, #0D6F6F 100%);
/* Opera */
background-image: -o-linear-gradient(top, #16ACAC 0%, #0D6F6F 100%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #16ACAC), color-stop(1, #0D6F6F));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(top, #16ACAC 0%, #0D6F6F 100%);
/* W3C Markup, IE10 Release Preview */
background-image: linear-gradient(to bottom, #16ACAC 0%, #0D6F6F 100%);
}
.main_menu
{
height: 24px;
line-height: 24px;
font-size: 12px;
position: relative;
}
.main_menu ul
{
padding: 0px 0px 0px 35px; /* padding on left to get nav menu to center.. since it has a float left to make it display properly*/
list-style: none;
}
.main_menu ul li
{
padding: 0;
margin: 0;
border-right: 2px solid #129F9F;
float: left;
}
.main_menu ul li.navcontact /* to stop right border at end of nav line */
{
padding: 0;
margin: 0;
border-right: none;
float: left;
}
.main_menu ul li a
{
color: #FFF;
display: block;
text-decoration: none;
padding: 0 15px;
}
.main_menu ul > li:hover > a, #navactive a:link, #navactive a:visited, #navactive > ul > li > a:hover
{
text-decoration: none;
color: #EAA339;
/* IE10 Consumer Preview */
background-image: -ms-linear-gradient(top, #0D6F6F 0%, #16ACAC 100%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(top, #0D6F6F 0%, #16ACAC 100%);
/* Opera */
background-image: -o-linear-gradient(top, #0D6F6F 0%, #16ACAC 100%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #0D6F6F), color-stop(1, #16ACAC));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(top, #0D6F6F 0%, #16ACAC 100%);
/* W3C Markup, IE10 Release Preview */
background-image: linear-gradient(to bottom, #0D6F6F 0%, #16ACAC 100%);
}
.main_menu ul li ul
{
display: none;
width: auto;
position: absolute;
padding: 0px;
margin: 0px;
}
.main_menu ul li:hover ul
{
display: block;
position: absolute;
margin: 0;
padding: 0;
}
.main_menu ul li:hover li
{
float: none;
list-style: none;
margin: 0px;
}
.main_menu ul li:hover li
{
font-size: 12px;
height: 24px;
background: #54C4C4;
/* border-top: 1px solid #129F9F; */
border: 1px solid #FFFFFF;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
-ms-border-radius: 5px;
border-radius: 5px;
}
.main_menu ul li:hover li a
{
font-size: 11px;
color: #fff;
padding: 0px;
display: block;
width: 150px;
}
.main_menu ul li li a:hover
{
font-size: 11px;
height: 24px;
color:#EAA339;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
-ms-border-radius: 5px;
border-radius: 5px;
}
And here is the HTML code:
<div id="navcontainer">
<div class="main_menu">
<ul>
<li id="navactive">Home
<ul>
<li>submenu 1
<ul>
<li>submenu 2</li>
</ul>
</li>
<li>submenu 3</li>
</ul>
</li>
<li>What is CSFF
<ul>
<li>submenu 4</li>
</ul>
</li>
<li>Make a Donation</li>
<li>Our Work
<ul>
<li>submenu 5
<ul>
<li>submenu 6</li>
</ul>
</li>
<li>submenu 7</li>
</ul>
</li>
<li>Events Outline</li>
<li class="navcontact">Contact Us</li>
</ul>
</div>
</div>
The reason you are getting this problem is due to your CSS and the way you have structured your HTML code. Here is your problem -
.main_menu ul > li:hover > a, #navactive a:link, #navactive a:visited, #navactive > ul > li > a:hover
{
STYLES
}
Simply change the "#navactive a:link" part of your CSS code above to a seperate class that handles the active link. Currently any link within the "navactive" div will inherit the styles given in this class, and this is why the sub menu text is appearing yellow and not white. So like I said change the above CSS code to a separate class, eg - "#navactive .current"
and then change your HTML code to look like this:
<div id="navcontainer">
<div class="main_menu">
<ul>
<li id="navactive"><a class="current" href="index.asp" title="Cancer Support for
Families Foundation is a community funded, community focused cancer charity.">Home</a>
That should do the trick! Obviously I haven't been able to test it, but let me know if you have any problems. Also just a tip - using the Chrome 'Inspect Element' function is really useful when faced with these kind of problems!
Problem 1
in the css:
.main_menu ul > li:hover > a, #navactive a:link, #navactive a:visited, #navactive > ul > li > a:hover
you should put a > in #navactive a:visited, and #navactive a: link so it looks like this:
.main_menu ul > li:hover > a, #navactive > a:link, #navactive > a:visited, #navactive > ul > li > a:hover
the ">" means you direct only the child element
edit
This question is solved!
Having something weird.
I'm using html { font-size: 100% } and body {font-size: 62.5%} so I have 1em == 10px in CSS. I've done this several times before.
Now on my page everything works fine with the font-size, except for the font in the navigation in IE8 and IE7 (XP Mode)
I've fiddled relevant the HTML/CSS code here http://jsfiddle.net/gk4j9/3/
Using modernizr for browser ability switch for the gradients and shadows
Zoom is 100%
Text zoom is medium
edit
For testing go here
http://netrenderer.com/index.php
and test this address
http://fiddle.jshell.net/gk4j9/3/show/light/
edit
The font-size is 2em, so should be 20px.
If I change to 1.8em in IE8 wih Developer Tools (18px) it looks quite the same as 2em in IE9 and other browsers
HTML
<div class="l-fullwrap clearfix">
<header class="page-header">
<div class="l-header-nav-primary">
<nav class="primary">
<ul>
<li class="first has-children">
<a href="javascript:;">
<span>Item 1</span>
</a>
</li><li class="has-children">
<a href="javascript:;">
<span>Item 2</span>
</a>
</li><li class="has-children">
<a href="javascript:;">
<span>Item 3</span>
</a>
</li>
</ul>
</nav>
</div>
</header>
</div>
CSS
html {
font-size: 100%;
}
html, button, input, select, textarea {
font-family: sans-serif;
color: #222;
}
body {
font-size: 62.5%;
line-height: 1.4em;
}
body {
font-family: Arial, Helvetica, sans-serif;
}
nav ul, nav ol {
list-style: none;
list-style-image: none;
}
a, a:link, a:visited {
color: #EFAA03;
}
a, a:link, a:visited {
color: #EFAA03;
}
a:visited {
color: #551A8B;
}
a, a:link, a:visited {
color: #EFAA03;
}
a {
color: #00E;
}
/* Primary Nav */
.l-header-nav-primary {
position: absolute;
right: 0px;
top: 45px;
}
nav.primary {
border-top: 1px solid #CDCDCD;
border-bottom: 1px solid #AAAAAA;
}
nav.primary,
nav.primary li{
display: inline-block;
*zoom: 1;
*display: inline;
vertical-align: baseline;
}
.no-cssgradients nav.primary li,
nav.primary li{
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d2d2d2', endColorstr='#979696',GradientType=0 ); /* IE6-9 */
}
.cssgradients nav.primary li,
nav.primary li{
line-height: 3.2em;
padding-right: 1px;
background: #979696; /* Old browsers */
background: -moz-linear-gradient(top, #d2d2d2 0%, #979696 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d2d2d2), color-stop(100%,#979696)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #d2d2d2 0%,#979696 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #d2d2d2 0%,#979696 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #d2d2d2 0%,#979696 100%); /* IE10+ */
background: linear-gradient(top, #d2d2d2 0%,#979696 100%); /* W3C */
filter: none;
}
nav.primary li.last{
padding-right: 0;
}
.no-cssgradients nav.primary a,
nav.primary a {
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#b6b6b6',GradientType='0' ); /* IE6-9 */
}
.cssgradients nav.primary a,
nav.primary a{
display: block;
background: #b6b6b6; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #b6b6b6 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#b6b6b6)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#b6b6b6 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#b6b6b6 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#b6b6b6 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#b6b6b6 100%); /* W3C */
filter: none;
}
nav.primary a {
display: block;
padding: 0 10px;
font-size: 2em;
font-family: Calibri;
font-weight: bold;
color: #333333;
text-decoration: none;
text-transform: uppercase;
text-shadow: 1px 1px rgba(255,255,255, 0.65);
height: 100%;
}
.no-textshadow nav.primary a span{
display: inline-block;
*zoom: 1;
*display: inline;
background-color: #E0E0E0;
-ms-filter: "Chroma(Color=#E0E0E0) DropShadow(OffX=1, OffY=1, Color=#FFFFFF)";
filter: Chroma(Color=#E0E0E0) DropShadow(OffX=1, OffY=1, Color=#FFFFFF);
}
.no-textshadow nav.primary li.active a span,
.no-textshadow nav.primary a:focus span,
.no-textshadow nav.primary a:hover span,
.no-textshadow nav.primary a:active span {
display: inline-block;
*zoom: 1;
*display: inline;
background-color: transparent;
-ms-filter: "none";
filter: none;
}
nav.primary li.active a,
nav.primary a:focus,
nav.primary a:hover,
nav.primary a:active,
.no-cssgradients nav.primary li.active a,
.no-cssgradients nav.primary a:focus,
.no-cssgradients nav.primary a:hover,
.no-cssgradients nav.primary a:active {
filter: none;
}
.cssgradients nav.primary li.active a,
.cssgradients nav.primary a:focus,
.cssgradients nav.primary a:hover,
.cssgradients nav.primary a:active,
nav.primary li.active a,
nav.primary a:focus,
nav.primary a:hover,
nav.primary a:active {
color: #FFFFFF;
background:#231F20;
text-shadow: none;
outline: none;
}
I figured it out.
In my XP Mode I do not have the Calibri font installed. So it uses a different font.
Bloody me!