CSS - Css Subnav Not Closing After Hover Off
Can anyone help me figure out why the subnav stays up after you hover off of it? It's happening in IE but not Firefox.
Here it is: http:// www4. ncsu.edu /~jrpoole/Help.html Edit: Remove the spaces in the URL, I'm not allowed to post links as a new member. Similar TutorialsHi Everyone! Here is a quick problem for any CSS gurus out there! I have created a horizontal navigation bar which has a horizontal drop down subnav on roll over of the top nav links The top nav don't link to a page but only act to display the subnav - dont worry I have posted the code below! I am having real trouble with one aspect - when you navigate to a page on the subnav (e.g. the "webcam" page) I want the subnav links for that section (eg "watch") to be displayed rather than only appearing when you roll over one of top navs links. Has anyone got any ideas of if this is possible with the way that I have structured the nav currently? Any help would be much appreciated! Thanks in advance! Here is the code Code: <style type="text/css"> * { margin: 0; padding: 0; } html {height:100%;} body{ background-color: #42530D; font-family: Arial, Helvetica, sans-serif; font-size: 0.75em; height:100%; } p { padding:5px; list-style: inside disc; font-size: 1em; } #wrap{ width: 784px; margin: 0 auto; border: 0; margin-bottom: 10px; } #top_text{ color:#FFFFFF; padding: 6px 78px 5px 0; font-size: 11px; text-align: right; } /* Here is the code for the nav! */ #container { position: relative; font-size: 1.2em; background-color:#5F5C47; position: relative; height:52px; } #navbar { background-color: #C1C1B0; position: absolute; float: left; padding: 0; width:100%; text-transform:capitalize; } #navbar li { list-style: none; float: left; text-transform:capitalize; } #navbar li a { display: block; text-decoration: none; color: #333333; padding:5px 10px 5px 10px; font-weight: normal; text-transform:capitalize; } #navbar li a:hover { color: #FFFFFF; background-color:#5F5C47; } #navbar li ul { display: none; } #navbar li:hover ul, #navbar li.hover ul { color: #FFFFFF; position: absolute; display: inline; left: 0; width: 100%; margin: 0; padding: 0; } #navbar li:hover li, #navbar li.hover li { float: left; } #navbar li:hover li a, #navbar li.hover li a { color: #FFFFFF; } #navbar li li a:hover { color: #333333; background-color: #C1C1B0;} </style> <script> //Here is the javascript for the nav! sfHover = function() { var sfEls = document.getElementById("navbar").getElementsByTagName("li"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" hover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" hover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); </script> </head> <body> <div id="wrap"> <div id="top_text"></div> <div id="bodywrap"> <div id="navwrap"> <div id="container"> <ul id="navbar"> <li><a href="#">HOME</a> </li> <li><a href="#">WATCH</a> <ul> <li><a href="webcam/index.htm">WEBCAM</a></li> <li><a href="index.htm">GALLERY</a></li> </ul> </li> <li><a href="#">EXPLORE</a> <ul> <li><a href="projects/index.htm">PROJECTS</a></li> <li><a href="tours/index.htm">VIRTUAL TOURS</a></li> <li><a href="games/index.htm">GAMES</a></li> </ul> </li> <li><a href="#">LISTEN</a> <ul> <li><a href="podcasts/index.htm">PODCASTS</a></li> </ul> </li> <li><a href="#">LEARN</a> <ul> <li><a href="blog/index.htm">BLOG</a></li> <li><a href="about">ABOUT</a></li> <li><a href="projects/index.htm">PROJECTS</a></li> </ul> </li> <li><a href="#">PARTICIPATE</a> <ul> <li><a href="get-involved.htm">GET INVOLVED</a></li> <li><a href="user-gallery.htm">USER GALLERY</a></li> <li><a href="forum/index.htm">FORUM</a></li> <li><a href="../send-a-postcard/index.htm">SEND A POSTCARD</a></li> </ul> </li> <li><a href="#">SUPPORT</a> <ul> <li><a href="support/index.htm">DONATE</a></li> <li><a href="other-ways-of-helping.htm">OTHER WAYS OF HELPING</a></li> </ul> </li> </ul> </div> </div> </div> </div> </body> </html> OK, I have a static sub-navigation on the left side of the page, which works just fine. You can see it here I'd like the sub-navigation to scroll to just beneath he header navigation, then stay put there, when the page is scrolled. Something like the Vogue web site does with the red navigation bar, which you can see here Can someone please explain, or give me an idea of how to accomplish this? I think it is with CSS. thanks I have a drop down menu located at http://www.fieldspianos.com/new/index.php If you hover over the menu items they turn black and white when you are right on the text but not if you are in the area surrounding it which is what I also need to occur. You can view the source on the page for the html but I will include the css below. This is the basic layout of the menu: Code: <ul> <li>About Us</li> <ul> <li><a href="#">Locations</a></li> etc..etc..etc.. Here is the css: Code: /*Begin Content of drop down menu*/ a { outline:none; } * html div#dropdownmenu ul { float: left; } * { margin: 0; padding: 0; } div#dropdownmenu { float: left; background-color: #C8C6C6; font-size:11px; font-family: Verdana, Arial, Helvetica, sans-serif; } div#dropdownmenu ul li { list-style-type: none; float: left; background-color: #000000; position: relative; } div#dropdownmenu ul li:hover { list-style-type: none; background-color: #000000; } /*Hides drop downs when not overed over and reveals them when they are hovered over.*/ body div#dropdownmenu ul li ul { display: none; } body div#dropdownmenu ul li:hover ul { display: block; } div#dropdownmenu ul li ul { margin: 0; width: 13em; position: absolute; left: -1px; } div#dropdownmenu ul li ul li { width: 100%; background-color:#bdb35e; color: #660000; border-bottom: 1px solid #000; border-left: 1px solid #000; border-right: 1px solid #000; padding: 3px; } div#dropdownmenu ul li ul li:first-child { border-top: 1px solid #000; } div#dropdownmenu ul li ul li:hover { color: #FFFFFF; background-color: #000000; } div#dropdownmenu ul li ul li a { color: #660000; text-decoration:none; outline: none; } div#dropdownmenu ul li ul li a:hover { color: #FFFFFF; background-color: #000000; text-decoration:none; outline: none; } div#dropdownmenu ul li:hover ul, div#dropdownmenu ul li ul:hover { display: block; } Any help is greatly appreciated, this seems like it would be a simple fix but I can't figure it out. Maybe I am overlooking some small detail. Thanks! I am having a problem with a CSS Menu in which the sub menu items are disappearing before I am able to get my mouse over them. I have tried adjusting the padding for the nav items but it did not have any effect but to shift all of the menu elements. Here is the html: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/css.css"/> <link rel="stylesheet" type="text/css" href="css/menu.css"/> <!--<script src="javascript/javascript.js" type="text/javascript" language="javascript"></script>--> <title>ACS Web Group - Administration Interface</title> </head> <body> <div id="pageContainer"> <div id="header"> <div id="headerLeft"> <img src="images/acs_header.jpg" width="332" height="55" hspace="0" vspace="0" /> </div> <div id="headerRight"> <a href="#"><img src="images/header_logout.jpg" width="60" height="55" hspace="0" vspace="0" border="0" /></a> </div> </div> <div id="menu"> <ul id="navbar"> <li><a href="#">Menu 1</a> <ul> <li><a href="#">Menu 1 - Sub 1</a></li> <li><a href="#">Menu 1 - Sub 2</a></li> </ul> </li> <li><a href="#">Menu 2</a> <ul> <li><a href="#">Menu 2 - Sub 1</a></li> <li><a href="#">Menu 2 - Sub 2</a></li> </ul> </li> <li><a href="#">Menu 3</a> <ul> <li><a href="#">Menu 3 - Sub 1</a></li> <li><a href="#">Menu 3 - Sub 2</a></li> </ul> </li> </ul> </div> <div id="body"> <div id="menuShade"> </div> </div> <div id="footer" align="center"> <a href="http://www.ACSWebGroup.com">www.ACSWebGroup.com</a> 905-827-7882 </div> </div> </body> </html> Here is the menu.css: Code: /* CSS Document */ #navbar { margin: 0px; padding: 0px; height: 1em; } #navbar li { list-style: none; float: left; } #navbar li a { display: block; padding: 3px 8px; color: #fff; text-decoration: none; } #navbar li ul { display: none; width: 10em; /* Width to help Opera out */ background-color: #fff;} #navbar li:hover ul { display: block; position: absolute; margin: 0px; padding: 0px; } #navbar li:hover li { float: none; } #navbar li:hover li a { /*background-color: #fff;*/ border-bottom: 1px solid #000; border-top: 1px solid #000; border-right: 1px solid #000; border-left: 1px solid #000; color: #000; } #navbar li li a:hover { background-color: #fff; } #navbar li:hover ul, #navbar li.hover ul { display: block; position: absolute; margin: 0px; padding: 0px; } #navbar li:hover li, #navbar li.hover li { float: none; } #navbar li:hover li a, #navbar li.hover li a { /*background-color: #fff;*/ border-bottom: 1px solid #000; border-top: 1px solid #000; border-right: 1px solid #000; border-left: 1px solid #000; color: #000; } and here is the css.css: Code: /* CSS Document */ html{ height:100%; margin:0px; padding:0px; overflow:hidden; } body{ margin:0px; padding:0px; height:100%; } #pageContainer{ width:100%; height:100%; margin:0px; padding:0px; } #header{ background-image:url(../images/header_background.jpg); background-repeat:repeat-x; height:55px; margin:0px; padding:0px; padding-right:25px; } #headerLeft{ float:left; margin:0px; padding:0px; } #headerRight{ float:right; margin:0px; padding:0px; } #menu{ background-image:url(../images/menu_background.jpg); background-repeat:repeat-x; height:20px; margin:0px; padding:0px; vertical-align:top; overflow:hidden; z-index:250; } #menuShade{ background-image:url(../images/menu_shading.png); background-repeat:repeat-x; position:relative; top:0px; left:0px; height:9px; margin:0px; padding:0px; } #body{ overflow:auto; margin:0px; padding:0px; height:100%; width:100%; position:absolute; top:75px; z-index:100; } #footer{ background-image:url(../images/footer_background.jpg); background-repeat:repeat-x; background-color:#003; position:relative; bottom:93px; left:0px; height:18px; margin:0px; padding:0px; font-size:10px; font-family:Georgia, "Times New Roman", Times, serif; color:#BFC0AD; padding-top:2px; } Any help would be greatly appreciated. Thanks, LiquidBuRn I have the following css Code: #navigation li { display: inline; background: url(Images/greenbg.gif) repeat-x center top; text-align: center; padding: 0; margin-right: 4px; float: left; } for the following html Code: <div id="navigation"> <ul> <li><a href=""><span>Menu1</span></a></li> <li><a href=""><span>Menu2</span></a></li> <li><a href=""><span>Menu3</span></a></li> <li><a href=""><span>Menu4</span></a></li> <li><a href=""><span>Menu5</span></a></li> </ul> </div> <br style="clear: both" /> and I can't figure out how to get the background to change when I hover. Anyone have any ideas? I tried this to no avail Code: #navigation a:hover li { display: inline; background: url(Images/greenbghover.gif) repeat-x center top; text-align: center; padding: 0; margin-right: 4px; float: left; } http://www.knowledge2work.com/testing/test.htm is a link to a menu that I have created. Essentially what I want to happen is that the mouseover on the submenu changes the background color and the text color as well. I have done this using td:hover and ids and it works just fine in Firefox but not at all in IE. Why is this? I know this has been discussed loads. And I have read a tonne of articles telling people it cannot be done in pure CSS. But I wanted a little clarification. I want a hover: over a <tr>. Now Im not fussed if it doesn't work in IE5/6 even 7 (although obviously it would be nice!) its a little feature to help users. My app is internal, so as long as the CSS doesn't break the page, then IE users just wont get the hover, while others will. This is what I have: .result_lines{ background-color:#EAEAEA; } .result_lines tr:hover{ background-color:#666666; color:#FFFFFF; } Now, having not done this, I wasn't even sure if the order of my syntax was correct, so a little direction would be perfect. Note: I don't want to use JS. Hi guys, Was wondering if you could tell me where I'm going wrong with this. Basically I have used the class "WhiteBoldLinks" on some text BUT when the mouse goes over the link I cant get the underline and text colour to work which is assigned to the class "#WhiteBoldLinks a:hover" . How do I use this? Or have I coded it wrong? PHP Code: .WhiteBoldLinks { font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; color: #FFFFFF; text-decoration: none; } #WhiteBoldLinks a:hover { text-decoration: underline; color: #FF0000; } I have two images, A and B. When I hover over image A, B appears over A, where B is at 25% opacity. If I wanted to make B appear after A, I would use this: Code: .imageA:hover:after{ content: url("images/imageB.jpg"); } or before.. Code: .imageA:hover:before{ content: url("images/imageB.jpg"); } How do I make B appear on top of A or underneath it? Thanks, Andy I know that td:hover isn't supported by all browsers but it is displaying some quirky behavior: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>My site</title> <style type="text/css"> #level0 table { border-spacing: 0; border-collapse: collapse; } /* end #level0 table */ #level0 table td { padding: 0; } #level0 #links_table { text-align: right; border-top: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1; height: 242px; width: 265px; } /* end #level0 #links_table */ #level0 #links_table td { border-top: 1px solid #f1f1f1; border-right: 1px solid #000000; border-bottom: 1px solid #f1f1f1; } /* end #level0 #links_table td */ #level0 #links_table td:hover { border: 1px solid #000000; border-right: 0; } /* end #level0 #links_table td:hover */ #level0 #links_table a { padding-right: 1em; } #level0 #rotating_image img { vertical-align: top; border: 1px solid #000000; border-left: 0; } /* end #level0 #rotating_image */ </style> </head> <body> <div id="level0"> <table id="main_table"> <tr> <td> <table id="links_table"> <tr><td><a href="#">Link 1</a></td></tr> <tr><td><a href="#">Link 2</a></td></tr> <tr><td><a href="#">Link 3</a></td></tr> <tr><td><a href="#">Link 4</a></td></tr> <tr><td><a href="#">Link 5</a></td></tr> <tr><td><a href="#">Link 6</a></td></tr> <tr><td><a href="#">Link 7</a></td></tr> <tr><td><a href="#">Link 8</a></td></tr> </table> </td> <td id="rotating_image"><img src="my_image.gif" alt=""></td> </tr> </table> </div> </body> </html> When I hover over the first cell, the top and bottom borders turns black but not the left, and all the right borders disappear. When I hover over the other cells, only the bottom border turns black. What I am trying to accomplish is when a table cell is moused over, the top, bottom, and left border of that cell turns from gray to black and the right border which is currently black turns white. Hello: I would like to have a big font size of title on my web site for search engine optimuzation purpose, I wrap the title with a H1, then I define H1 in css as FONT-WEIGHT: bold; FONT-SIZE: 34px; COLOR: #000000; in other place I also have A:hover {COLOR: #6460AD; TEXT-DECORATION: underline; the title I put in is a hyper link, so when the mouse hovers on the title, the title shown as underlined, I want it to be TEXT-DECORATION: none I don't know the syntax in H1 definetion to disable the underline i have 2 divs div1 and div2 there is an image in div2 and there is a link in div1, by default the image in div2 is hidden and i have used #div2 img{ visibility: hidden; // also i tried display: none; } when i move the mouse over the link in div1 i want the image in div2 to appear following is my code #div1 a:hover #div2 img1{ visibility: hidden; or display: none; } the image in div2 is not appearing without using javascript or jquery can this simple effect be done by using css code can someone tell me the correct syntax to show the image please advice. thanks Hi, I have found a nice feature on this website; click here When you mouse over grey - orange images another div comes out. What this is called? Is there any example code that I can work on? Thanks. Thanks for taking the time to read my question. This works in FF but not IE6. What do I need to change to make it work I have borders around my images which are links and I want the border color to change on hover HTML Code: <a href="LisaClarkDesigns_About.htm"><img class="ImgNav" src="images/AboutNav.gif" alt="Click here to navigate to the About Lisa Clark Designs page." /></a> CSS for container Code: img.ImgNav { border: 1px solid #999999; padding: 0px; margin: 0px 10px 0px 10px; width: 52px; } CSS for hover Code: <a href="LisaClarkDesigns_About.htm"><img class="ImgNav" src="images/AboutNav.gif" alt="Click here to navigate to the About Lisa Clark Designs page." /></a> <a href="LisaClarkDesigns_Portfolio.htm"><img class="ImgNav" src="images/PortfolioNav.gif" alt="Click here to navigate to the Lisa Clark Designs Portfolio page." /></a> <a href="LisaClarkDesigns_Fees.htm"><img class="ImgNav" src="images/FeesNav.gif" alt="Click here to navigate to the Lisa Clark Designs Fees page." /></a> <a href="LisaClarkDesigns_Contact.htm"><img class="ImgNav" src="images/AboutNav.gif" alt="Click here to navigate to the Lisa Clark Designs Contact page." /></a> Thanks, Brad hey there i was wondering why on hover the .indexThumbDiv dosnt display as a block in IE6 but in IE7 and firefox it does. head: PHP Code: .indexThumbDiv{display:none;} a.indexThumbA:hover .indexThumbDiv{display:block;} body: PHP Code: <a class="indexThumbA" href="link"> span class="indexThumbDiv"></span> <img src="link" width="120" height="120" border="0" style="vertical-align:bottom"/> </a> Hi there, I would like for the background of a text link to change colour when the mouse hovers over the text... no problem a:hover {background:#72b83c} However I would like to STOP the background of an image doing the same thing.... this I am having trouble with. I've tried a:hover img {background:none} a:hover img {background:none!important} But it doesn't seem to work (the background still changes behind the image (showing the colour around the left and bottom of the image). Can anyone offer any suggestions? Paul I don't know is it done before or not but i made it ,, i got rid of the onmouseover:crab tags but i think if you announce it as harmless I have use it again because I'll to write three times more code to get what i want with that hover thing. both functional in ie and ff css Code: .ortadiv:link {background-color:#EFEFEF;} * html .ortadiv {background-color:#EFEFEF;} /*hack*/ .ortadiv:hover {background-color:white; cursor:default} html -(my code looks like that) Code: <a class="ortadiv" href="#"><span><h5></h5></span></a> (it doesn't validates !) my main concern is about my headers , because when i use my css-hack-hover they becomes links with "#" . Is it affects search-engine things ? edit: I decided to not to use it because of my validating concerns I want to change the color of an <a> when a list element is hovered over, using CSS. Is this possible? Or do I need to resort to Javascript? Code: <style> a { color: red; } #menu ul li:hover { background: red; color: white; } </style> <div id="menu"> <ul> <li><a href="home.html">Home</li> </ul> I can do a change to: #menu ul li:hover, #menu ul a:hover { background: red; color: white; } but the anchor won't change color on the li:hover, so it looks red on red. I am having trouble with a:hover in I.E , I have a javascript link that is using php to open a browser window. I am unable to use <a href=""> instead I am using <a onclick=""> . Everything works well until I test in I.E and the a:hover style is not working. Does anyone know of a fix to this problem? the css is a:hover { text-decoration: underline; } Thanks for taking the time to read my question. I am having problems with hover on my menu. Just before you mouse over the next button, the previous one lights up. I really don't know why. See: #MenuItemTop and #MenuItem I've attached my html, and my css. I have no where to post it. Thanks again. Brad |