I'm having a weird problem with my navigation in IE 6. Only the first and last links of the navigation bounce when hovered over.
Why would this be happening?
My CSS file:
#navigation {
width: 930px;
height: 30px;
background-color: #f1faff;
text-align:center;
}
#navigation ul {
margin: 0px;
padding: 0px;
list-style: none;
line-height: 30px;
}
#navigation ul li {
display: inline;
}
#navigation ul li a {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #0067b4;
display: inline;
text-decoration: none;
text-transform: uppercase;
padding: 7px 50px;
}
#navigation ul li a:hover {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #5e5e5e;
display: inline;
text-decoration: none;
text-transform: uppercase;
padding: 7px 50px;
}
#navigation ul li a.first {
padding-left: 8px;
margin: 0px;
overflow: hidden;
border: 0px;
}
#navigation ul li a.last {
padding-right: 8px;
margin: 0px;
overflow: hidden;
border: 0px;
}
The site where this is happening is available at http://www.paysonsecure.com/protekskiracing/
I would add this to your global-ie6.css
#navigation ul { display: inline-block; }
Thanks gutierrezalex!! I had the same problem and it works adding {display: inline-block;} at my styles..it works for any browser:
ul.menu li a{
text-decoration:none;
color:black;
display:block;
padding:0;
margin:0;
display:inline-block;
}
ul.menu li a:hover{
background-color:#5cc2ed;
color:#ffffff;
display:inline-block;
}
Related
I have used text-align: center inside, but .main-nav was not effected. What is the best way to center this navigation?
/***** Navigation *****/
.main-nav { font-family: 'Lato', Helvetica, Arial, sans-serif; font-weight: 900; text-transform: uppercase; }
.main-nav li { float: left; position: relative; }
.main-nav li a { display: block; color: #333131; font-size: 16px; font-size: 1rem; line-height: 1; letter-spacing: 2.7px; padding: 12px 0; margin-right: 30px; }
.main-nav li a:hover { color: #000; }
.main-nav ul li a, .main-nav ul .current-menu-item:hover > a { border-bottom: 2px solid #fff; }
.main-nav ul .current-menu-item > a { border-bottom: 2px solid red; color: #000; }
.main-nav ul ul li a, .main-nav ul ul .current-menu-item:hover > a, .main-nav ul ul .current-menu-item > a { border: none; }
.main-nav ul li:hover > ul { display: block; background: #fff; z-index: 9999; }
.main-nav ul ul { display: none; position: absolute; left: -20px; }
.main-nav ul ul li { padding: 0 20px; width: 13rem; background: #f6f6f6; }
.main-nav ul ul ul { left: 100%; top: 0; }
Your nav container should have below property to make it center: I have not tested. if you want exact solution create fiddler or share HTML code as well.
.navContainer{
width:100px; <!-- This value can be any -->
margin: 10px auto; <!-- first value of margin can be any -->
}
i use this css code in IE7 and it works great without any problems.
Now in IE11 and chrome the drop down doesn't work i see the main menu and all sub menus together.
need an assistance in that to understand what can be done to fix it.
Thanks.
<div id='cssmenu'>
<ul>
<li class='active'><a href='url'><span>text</span></a></li>
<li class='has-sub'><a href='#'><span>text</span></a></li>
<ul>
<li><a href='url'><span>text</span></a></li>
<li><a href='url'><span>text</span></a></li>
</ul>
body {
background: #4096EE url(images2/img1.jpg) repeat-x;
text-align: justify;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: small;
color: #333333;
}
h1 {
}
h2, h3 {
margin-top: 0px;
}
h4, h5, h6 {
}
p, ol, ul, dl, blockquote {
}
a {
color: #1B4978;
}
a:hover {
text-decoration: none;
}
/* Header */
#header {
width: 600px;
height: 60px;
margin: 0px auto;
}
#header h1 {
float: left;
margin: 0px;
padding-top: 20px;
font-size: 42px;
letter-spacing: -2px;
}
#header h2 {
float: right;
margin: 10px 0px 0px 0px;
padding-top: 28px;
font-size: 16px;
letter-spacing: -1px;
color: #FFFFFF;
}
#header a {
text-decoration: none;
color: #FFFFFF;
}
/* Menu */
#menu {
width: 600px;
height: 30px;
margin: 0px auto;
}
#menu ul {
margin: 0px;
padding: 0px;
list-style: none;
}
#menu li {
display: inline;
}
#menu a {
display: block;
float: left;
width: 120px;
padding: 5px 0px;
text-align: center;
text-decoration: none;
font-weight: bold;
background: #EEEEEE;
}
#menu a:hover {
background: #CCCCCC;
}
/* Content */
#content {
background: #FFFFFF;
width: 600px;
margin: 0px auto;
padding: 2px 0px 0px 0px;
}
#colOne {
float: right;
width: 360px;
margin-top: 20px;
padding-right: 20px;
}
#colTwo {
float: left;
width: 180px;
margin-top: 20px;
padding-right: 20px;
padding-left: 20px;
}
#colTwo ul {
margin-left: 0px;
padding-left: 0px;
list-style-position: inside;
}
#content h1 {
background-color: #B2D4F7;
padding: 5px 0px 5px 5px;
color: #173E68;
}
#content h2 {
background-color: #B2D4F7;
padding: 5px 0px 5px 5px;
text-transform: uppercase;
font-size: 16px;
color: #173E68;
}
#content h3 {
color: #2F73B8;
}
/* Footer */
#footer {
width: 600px;
margin: 0px auto;
padding: 3px 0px 0px 0px;
height: 50px;
background: #EEEEEE;
}
#footer p {
margin: 0px;
padding-top: 15px;
text-align: center;
font-size: 11px;
color: #999999;
}
#footer a {
color: #666666;
}
#footer a:hover {
color: #333333;
}
#cssmenu{
border:none;
border:0px;
margin:0px auto;
padding:0px;
font: 67.5% 'Lucida Sans Unicode', 'Bitstream Vera Sans', 'Trebuchet Unicode MS', 'Lucida Grande', Verdana, Helvetica, sans-serif;
width:600px;
font-size:14px;
font-weight:bold;
}
#cssmenu ul{
background:#333333;
height:35px;
list-style:none;
margin:0;
padding:0;
}
#cssmenu li{
float:left;
padding:0px;
}
#cssmenu li a{
background:#333333 url('seperator.gif') bottom right no-repeat;
color:#cccccc;
display:block;
font-weight:normal;
line-height:35px;
margin:0px;
padding:0px 25px;
text-align:center;
text-decoration:none;
}
#cssmenu li a:hover, #cssmenu ul li:hover a{
background: #2580a2 url('hover.gif') bottom center no-repeat;
color:#FFFFFF;
text-decoration:none;
}
#cssmenu li ul{
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:225px;
z-index:200;
/*top:1em;
/*left:0;*/
}
#cssmenu li:hover ul{
display:block;
}
#cssmenu li li {
background:url('sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:225px;
}
#cssmenu li:hover li a{
background:none;
}
#cssmenu li ul a{
display:block;
height:35px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
#cssmenu li ul a:hover, #cssmenu li ul li:hover a{
background:#2580a2 url('hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
}
#cssmenu p{
clear:left;
}
I'm surprised that HTML works as expected anywhere, but then IE7 is a large pile of bugs.
You have a <ul> as a child of another <ul>, which isn't valid HTML. <ul> can only contain <li> elements. That sub-menu list should be the child of the <li> above it:
<li class='has-sub'><a href='#'><span>text</span></a>
<ul>
<li><a href='url'><span>text</span></a></li>
<li><a href='url'><span>text</span></a></li>
</ul>
</li>
body {
background: #4096EE url(images2/img1.jpg) repeat-x;
text-align: justify;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: small;
color: #333333;
}
h1 {
}
h2, h3 {
margin-top: 0px;
}
h4, h5, h6 {
}
p, ol, ul, dl, blockquote {
}
a {
color: #1B4978;
}
a:hover {
text-decoration: none;
}
/* Header */
#header {
width: 600px;
height: 60px;
margin: 0px auto;
}
#header h1 {
float: left;
margin: 0px;
padding-top: 20px;
font-size: 42px;
letter-spacing: -2px;
}
#header h2 {
float: right;
margin: 10px 0px 0px 0px;
padding-top: 28px;
font-size: 16px;
letter-spacing: -1px;
color: #FFFFFF;
}
#header a {
text-decoration: none;
color: #FFFFFF;
}
/* Menu */
#menu {
width: 600px;
height: 30px;
margin: 0px auto;
}
#menu ul {
margin: 0px;
padding: 0px;
list-style: none;
}
#menu li {
display: inline;
}
#menu a {
display: block;
float: left;
width: 120px;
padding: 5px 0px;
text-align: center;
text-decoration: none;
font-weight: bold;
background: #EEEEEE;
}
#menu a:hover {
background: #CCCCCC;
}
/* Content */
#content {
background: #FFFFFF;
width: 600px;
margin: 0px auto;
padding: 2px 0px 0px 0px;
}
#colOne {
float: right;
width: 360px;
margin-top: 20px;
padding-right: 20px;
}
#colTwo {
float: left;
width: 180px;
margin-top: 20px;
padding-right: 20px;
padding-left: 20px;
}
#colTwo ul {
margin-left: 0px;
padding-left: 0px;
list-style-position: inside;
}
#content h1 {
background-color: #B2D4F7;
padding: 5px 0px 5px 5px;
color: #173E68;
}
#content h2 {
background-color: #B2D4F7;
padding: 5px 0px 5px 5px;
text-transform: uppercase;
font-size: 16px;
color: #173E68;
}
#content h3 {
color: #2F73B8;
}
/* Footer */
#footer {
width: 600px;
margin: 0px auto;
padding: 3px 0px 0px 0px;
height: 50px;
background: #EEEEEE;
}
#footer p {
margin: 0px;
padding-top: 15px;
text-align: center;
font-size: 11px;
color: #999999;
}
#footer a {
color: #666666;
}
#footer a:hover {
color: #333333;
}
#cssmenu{
border:none;
border:0px;
margin:0px auto;
padding:0px;
font: 67.5% 'Lucida Sans Unicode', 'Bitstream Vera Sans', 'Trebuchet Unicode MS', 'Lucida Grande', Verdana, Helvetica, sans-serif;
width:600px;
font-size:14px;
font-weight:bold;
}
#cssmenu ul{
background:#333333;
height:35px;
list-style:none;
margin:0;
padding:0;
}
#cssmenu li{
float:left;
padding:0px;
}
#cssmenu li a{
background:#333333 url('seperator.gif') bottom right no-repeat;
color:#cccccc;
display:block;
font-weight:normal;
line-height:35px;
margin:0px;
padding:0px 25px;
text-align:center;
text-decoration:none;
}
#cssmenu li a:hover, #cssmenu ul li:hover a{
background: #2580a2 url('hover.gif') bottom center no-repeat;
color:#FFFFFF;
text-decoration:none;
}
#cssmenu li ul{
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:225px;
z-index:200;
/*top:1em;
/*left:0;*/
}
#cssmenu li:hover ul{
display:block;
}
#cssmenu li li {
background:url('sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:225px;
}
#cssmenu li:hover li a{
background:none;
}
#cssmenu li ul a{
display:block;
height:35px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
#cssmenu li ul a:hover, #cssmenu li ul li:hover a{
background:#2580a2 url('hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
}
#cssmenu p{
clear:left;
}
<div id='cssmenu'>
<ul>
<li class='active'><a href='url'><span>text</span></a></li>
<li class='has-sub'><a href='#'><span>text</span></a>
<ul>
<li><a href='url'><span>text</span></a></li>
<li><a href='url'><span>text</span></a></li>
</ul>
</li>
</ul>
</div>
I have a main menu that i have styled with an underline appearing on the hover state.
However I don't want this to appear on the submenu categories.
This is my code:
#menu_container { padding: 0px 0; text-align: center; }
#menu_container a:hover{background: url("/main/nav.gif") repeat-x scroll 0px 20px transparent;}
#menu_container ul { list-style-type: none; margin: 0; padding: 0; text-align: center; }
#menu_container ul li { margin-left: 15px; font-family: 'Lato', sans-serif; font-weight: 900; font-size: 1.2em; color: #000; position: relative; padding-bottom: 10px; text-transform: uppercase; display: inline-block; letter-spacing:1px; }
#menu_container ul li:first-child { margin-left: 0; }
#menu_container ul li a { color: #000; text-decoration: none; display:inline-block; padding-bottom: 5px; padding:10px; border-radius: 0px;}
#menu_container ul li a:hover { color: #000; -webkit-transition: background 0.5sease;-moz-transition: background 0.5sease;-ms-transition: background 0.5sease;-o-transition: background 0.5sease;transition: background 0.5sease;}
#menu_container ul li.current-menu-item a,
#menu_container ul li.current_page_item a { color: #b9b9b9;}
#menu_container ul li ul { position: absolute; top: 35px; left: 0; padding: 1px 1px; z-index: 25; display: none; border-radius: 3px; text-align: left; }
I think you're asking for this:
#menu_container ul li a { text-decoration: none; ...}
#menu_container ul li a:hover { text-decoration: underline; ... }
#menu_container ul li li a:hover { text-decoration: none; ... } /* no hover underline on sublinks */
The underlying idea is selector specificity. A specific contextual selector (#menu_container ul li li a) overwrites a more generic definition (#menu_container ul li a).
See CSS priority scheme:
http://en.wikipedia.org/wiki/Cascading_Style_Sheets#CSS_Priority_scheme_.28highest_to_lowest.29
I've created a drop down menu using css where the drop down appears as a horizontal row instead of a vertical list. My only problem is that the drop down menu does not line up with the rest of menu. I want it to be flush with the left side of the navigation bar.
The page is up at this address: http://concept82.com/CBHweb/index2.html
The code for my drop down menu is:
#navholder{
background-color: #594361;
margin: 0 auto;
width: 868px;
height: 25px;
font-family: P22, Helvetica, Arial, sans-serif;
}
#nav {
margin: 1px;
padding: 0px;
}
#nav li {
list-style: none;
float: left;
}
#nav li a {
display: block;
color: #FFFFFF;
font-size: 14px;
text-align: center;
margin-top: 5px;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 3px;
width: 140px;
}
#nav li a:hover {
color: #201E30;
}
#nav li ul {
display: none;
}
#nav li ul a{
width: auto;
font-size: 11px;
}
#nav li:hover ul, #nav li.hover ul {
position: absolute;
left: 0;
display: inline;
padding-top: 5px;
}
#nav li:hover li, #nav li.hover li {
float: left;
display: block;
text-decoration: none;
color: #594361;
font-size: 11px;
border-right: 1px solid #594361;
padding: 0px 15px 0px 15px;
margin-top: 3px;
margin-bottom: 3px;
white-space: nowrap;
}
#nav li.first, #nav li.hover li.first {
float: left;
display: block;
text-decoration: none;
color: #594361;
font-size: 11px;
border-left: 1px solid #594361;
padding: 2px 15px 2px 5px;
margin-top: 3px;
white-space: nowrap;
}
#nav li:hover li a, #nav li.hover li a {
color: #201E30;
background-color: #FFFFFF;
}
#nav li li a:hover {
color: #201E30;
}
Thanks ahead of time!
You should change position of #navholder as relative.
#navholder{
position: relative;
background-color: #594361;
margin: 0 auto;
width: 868px;
height: 25px;
font-family: P22, Helvetica, Arial, sans-serif;
}
When you define the ul when hovering on the list you specify left as 0 px, aligining it to the left of the page, change it to your margin width then it will be in the right place
#nav li:hover ul, #nav li.hover ul {
position: absolute;
left: 0;
display: inline;
padding-top: 5px;
}
I am using a simple list as navigation which brings up the appropriate background image depending on the state of the link normal, hover or current. In IE6 the current or actual page is being ignored, not displaying the different image and leaving the link active. The code is -
<div id="mainNav">
<ul>
<li>Home</li>
<li>Projects</li>
<li>Contact</li>
</ul>
</div>
The CSS for the navigation is -
#topcontent1 #mainNav {
position: absolute;
left: 86px;
width: 328px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 0.9em;
padding: 0px;
clear: both;
color: #666633;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
font-weight: 700;
text-transform: uppercase;
}
#topcontent1 #mainNav ul {
list-style: none;
margin: 0;
padding: 0;
float: left;
width: 100%;
}
#topcontent1 #mainNav li {
float: left;
margin: 0;
padding:0;
display: block;
}
#topcontent1 #mainNav li a:link, #topcontent1 #mainNav li a:visited {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 1em;
color: #fff;
text-decoration: none;
display: block;
background-repeat: no-repeat;
margin-right: 10px;
width: 99px;
height: 62px;
margin-top: 0px;
line-height: 62px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0;
text-align: center;
padding-top: 60px;
background-image: url('../images and html/images/tabnorm.jpg');
}
#topcontent1 #mainNav li a:hover {
color: #f8b449;
border: none;
background-image: url('../images and html/images/tabhover.jpg');
background-repeat: no-repeat;
}
#topcontent1 #mainNav ul li a.current {
color: #AAB3B2;
background-image: url('../images and html/images/tabcurr.jpg');
background-repeat: no-repeat;
}
#topcontent1 #mainNav ul li a.current:hover {
color: #AAB3B2;
cursor: default;
}
The #topcontent1 #mainNav ul li a.current style is seemingly being ignored by IE6.
can anyone see an issue or suggest a work around
IE6 seems to have problems with complicated selector statements. maybe try using
#mainNav a.current
instead of
#topcontent1 #mainNav ul li a.current
Change this in your code
#topcontent1 #mainNav li a:link, #topcontent1 #mainNav li a:visited {
to
#topcontent1 #mainNav li a {