CSS - Trouble With Hover In Css
Greetings!
I seem to have some problems with the hover pseudo-class in IE6. I have tried many combinations but cannot get the color to change on a hover. The other attributes seem to work ok, such as background color, cursor, etc. When I place the COLOR attribute in, IE6 just seems to ignore it. here are the significant snippets of the CSS: This is at the very top of the CSS external..note that the color that is desired on hover is #0000FF or blue: Code: A:link {color: #FFFF00; text-decoration: none} A:visited {color: #FFBF00; text-decoration: none} A:hover {color: #0000FF; text-decoration: none} A:active {color: #C0FFC0; text-decoration: none} I am using relative positioning for my "menu" elements, so I created a CSS block for each item that results in the following: Code: #home, a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; font-style: italic; font-weight: bold; color: #CC0000; position: relative; top: -200px; left: -390px; text-decoration: none; } #aboutus, a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; font-style: italic; font-weight: bold; color: #CC0000; position: relative; top: -170px; left: -460px; text-decoration: none; } #services, a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; font-style: italic; font-weight: bold; color: #CC0000; position: relative; top: -140px; left: -553px; text-decoration: none; } #faqs, a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; font-style: italic; font-weight: bold; color: #CC0000; position: relative; top: -110px; left: -682px; text-decoration: none; } #contact, a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; font-style: italic; font-weight: bold; color: #CC0000; position: relative; top: -97px; left: 170px; text-decoration: none; } As can be seen the base color or starting color of the menu item is #CC0000 (red). The actual HTML is very simple: Code: <a id="home" href="index3.html">Home</a> <a id="aboutus" href="aboutus.htm">About Us</a> <a id="services" href="services.htm">Our Services</a> <a id="faqs" href="faqs.htm">Questions</a> <a id="contact" href="contactus.htm">Contact Us</a> What now happens, is that each menu item displays in RED, but when you hover over it, the text does not change color to the BLUE that I want. It just remains RED. Yet, when I add an attribute such as "background-color: green" to that HOVER directive, it works fine, it just wont change the text. Is this one of those Microsoft IE problems, or am I doing something wrong?? Thanks, in advance for your help! Kork Similar TutorialsHi, I've been at this for some time now. Currently building a site (development address: mainline.divsharp.com). Menu (left) was Javascript, its now CSS. Works fine in Chrome, Firefox and IE 8, but IE 7 is acting extremely strange. You can see the desired effect if you use a recent version of one of those browsers. When I pull it up in IE 7 on the homepage, I can't hover over the popup like I can in the other, more compliant browsers. It either hides the pane as soon as the mouse gets off the main menu link, or when the mouse leaves the picture once its over the pane. If I then click on, say, "Market Watch" and try to view the menu on an interior page, its even more erratic. I'm about at the end of what I know or can look up how to do here.. If I can get the mouse over some part of the popout pane, it seems that if its over the content area of a div and not padding or margins, it stays open. For example, over the picture or over the grey area to the right... This might suggest something to someone.. Unfortunately, the markup is clogged at best and my style is all over the place. Site is built in Wordpress and is a custom theme. Hopefully this will help: Home page style sheet: mainline.divsharp.com/wp-content/themes/mainline/style.css Interior page style sheet: mainline.divsharp.com/wp-content/themes/mainline/interior.css In those stylesheets, there isn't much discernible organization, but the pieces relating to this problem are near the id's labeled menu_bg in the middle and at the very bottom is where the hover effects are. The popout is achieved like this: Code: <li id="popout_hov"> <div id="popout">code for menu pane</div> </li> #popout_hov #popout { visibility: none; } #popout_hov:hover #popout { visibility: visible; } Thanks. Hello! Here is a test page that I made up to show my problem, CSS Testpage. Viewing this page in IE, or Netscape will show you the differences in the two browsers. The setup: I am using images as links, and when you mouse over them I want the border to swap colors, extremely simple and plain action. I am just trying to get it too work in all browsers (current ones). The CSS code: Code: body { margin: 0px; padding: 0px; text-align:center; background-color:00aa00; } span { padding: 1px; } #wrapper { margin:0px auto; width:740; text-align:left; } #workOpera,#workNetscape,#workIE { margin: 10px; white-space:nowrap; text-align:center; border:0px solid #00f; padding: 0px 5px 40px 5px; float:left; position:relative; border: 1px solid #00f; } h2 { color:#FFFF33; } h3 { color:#00CCFF; } #workOpera img { border:1px solid #ccc; } #workOpera a { border:0px solid #CCCCCC; } #workOpera a:hover img{ border:1px solid #FFFFFF; } #workNetscape img { border:1px solid #ccc; } #workNetscape a :link { border:0px solid #CCCCCC; } #workNetscape a :hover { border:1px solid #FFFFFF; } #workIE img { border:0px solid #ccc; } #workIE a { border:1px solid #CCCCCC; } #workIE a:hover { border:1px solid #FFFFFF; } #largeImageIE img { border:0px solid #ccc; } #largeImageIE a { border:1px solid #ccc; } #largeImageIE a:hover { border:1px solid #FFFFFF; } #largeImageNet img { border:1px solid #ccc; } #largeImageNet a :link { border:0px solid #ccc; } #largeImageNet a :hover { border:1px solid #FFFFFF; } The HTML Code: Code: <div id="wrapper"> <div style="margin:15px; padding:5px; background-color:#99CC99; color:#663399; width:700px; display:block;"> <p>Okay, Now if you are viewing this is in IE, you can see that the IE mouseover is working. But the rest of them are not. The mouseover you are looking for is the border changes color.</p> <p>If you are viewing this in Opera or Netscape (new versions) you will see that everything except the IE section is working as it should.</p> <p>The IE section (if viewing from Opera or Netscape) shows the border off from the image, it doesn't "surround" the image like I think it should.</p> <p>Is there a way to combine the IE, and the Netscape/Opera versions so that what I want to accomplish will work no matter what browser the person is using.</p> </div> <div id="workOpera"> <h3>Works in Opera 7.5.4</h3> <span><a href="/" target="_top"><img src="gifs/glohome.gif" alt="Home Page" ></a></span> <span><a href="index.html" target="core"><img src="gifs/glohandbook.gif" alt="Employee Handbook"></a></span> </div> <div id="workNetscape"> <h3>Works in Netscape 7.2</h3> <span><a href="/" target="_top"><img src="gifs/glohome.gif" alt="GLO Agency Home Page" ></a></span> <span><a href="index.html" target="core"><img src="gifs/glohandbook.gif" alt="Employee Handbook"></a></span> </div> <div id="workIE"> <h3>Works In Internet Explorer 6.0</h3> <span><a href="/" target="_top"><img src="gifs/glohome.gif" alt="Home Page" ></a></span> <span><a href="index.html" target="core"><img src="gifs/glohandbook.gif" alt="Employee Handbook"></a></span> </div> <br clear="all"> <table border="0" cellpadding="10" cellspacing="0" align="center"> <tr> <td colspan="2" align="center"><h2>Right Side: IE | Left Side: Opera/Netscape</h2></td> </tr> <tr> <td align="center"> <div id="largeImageIE"> <h3>Internet Explorer<br>Transparent GIF 250X250</h3> <a href="/" target="_blank"><img src="gifs/250X250T.gif" width="250" height="250"></a> </div> </td> <td align="center"> <div id="largeImageNet"> <h3>Netscape / Opera<br>Transparent GIF 250X250</h3> <a href="/" target="_blank"><img src="gifs/250X250T.gif" width="250" height="250"></a> </div> </td> </tr> </table> </div> </div> What happens is the code that works in IE, for some reason doesn't surround the image correctly in Netscape or Opera (or Mozilla Firefox). It's like 3 pixels lower or something or the image is bumped up 3 pixels. It's strange. Viewing the testpage in IE and then in Netscape should show you what I am trying to explain and failing badly at. bpmann 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 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. 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 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 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 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; } 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 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. 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 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> 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. 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 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? 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 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. Hello, I am designing a web page and I am having problems with a hover effect in IE6. The page is located at http://www.backontrack.nu/egusin/layout.php and if you hover over the menu items using Firefox (or any other real browser) you will see the hover effect. If you try doing this in IE6 there won't be any hover. Is there some obvious way of fixing this that I'm missing? Another thing, I would like to center the page. I can do this by adding margin: 0 auto; to the container class but this doesn't work in IE6. I know I could do the centering with a wrapper and some negative margins but I'd rather avoid that if at all possible. The odd thing someone at http://www.xs4all.nl/~peterned/examples/csslayout1.html is using the technique I tried for centering and it seems to work for him, even in IE6. Thanks in advance! /Robert When you hover over Contact Us/info the menu that drops down by the way i'm using the pixo plugin for that the words end up being seen through the tab.. and the news thing that scrolls that is using the plugin Announcement and vertical scroll news How do you fix that? This is a problem in Firefox, IE etc.. is the url mcshanesnursery dot com I'm trying to make a menu using only css basically when you hover over an li element if there is another level below it a div is moved into place to reveal the links. It is working for the top level, but I can't figure out why it won't display/work for the 3rd tier. Both the css and the html validated, a link and the code is below. Thanks for any advice. edit: I can't actually post the link but I will PM it to anyone who wants to see it halfway working. HTML: ------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "edit:no links"> <html> <head> <title>Test Page for drop menu</title> edit:there would be an include for the css here but I can't post anything resembling a link </head> <body> <div id="menuHolder"> <ul> <li><a href="#url">Advising Network</a> <div class="subHolder"> <ul> <li><a href="#url">Student PASSPort</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> <li><a href="#url">Test 3</a></li> <li><a href="#url">Test 4</a></li> </ul> </div> </li> <li><a href="#url">Adivsor PASSPort</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> <li><a href="#url">Test 3</a></li> </ul> </div> </li> <li><a href="#url">Form Bank</a></li> <li><a href="#url">Timeline</a></li> <li><a href="#url">Videos</a></li> <li><a href="#url">Contact</a></li> </ul> </div> </li> <li><a href="#url">Career Investigations</a> <div class="subHolder"> <ul> <li><a href="#url">Student</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> <li><a href="#url">Test 3</a></li> <li><a href="#url">Test 4</a></li> </ul> </div> </li> <li><a href="#url">Alumni</a></li> <li><a href="#url">Parents and Family Members</a></li> <li><a href="#url">Employers</a></li> <li><a href="#url">eRecruiting</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> </ul> </div> </li> </ul> </div> </li> <li><a href="#url">Campus Life</a> <div class="subHolder"> <ul> <li><a href="#url">Student and University Life</a></li> <li><a href="#url">Student Activities</a></li> <li><a href="#url">Commuter Services</a></li> <li><a href="#url">Community Service Learning</a></li> <li><a href="#url">USM Partnership with STRIVE U</a></li> <li><a href="#url">USM Calendar of Events</a></li> </ul> </div> </li> <li><a href="#url">Scholarships and Finances</a></li> <li><a href="#url">Academic Success</a> <div class="subHolder"> <ul> <li><a href="#url">Academic Strategies</a></li> <li><a href="#url">Courses</a></li> <li><a href="#url">Additoinal Support Resources</a></li> </ul> </div> </li> <li><a href="#url">Major Discovery</a> <div class="subHolder"> <ul> <li><a href="#url">Being Undeclared</a></li> <li><a href="#url">GO Program</a></li> <li><a href="#url">Aspirations - Early Study</a></li> <li><a href="#url">Choosing Your Major</a></li> <li><a href="#url">FAQ</a></li> </ul> </div> </li> <li><a href="#url">Orientation</a></li> </ul> </div> </body> </html> CSS ------------------- a {text-decoration:none; color:#ffffff;} #menuHolder {height:60px; background:#0072ad; position:relative; text-align:center; width:1000px; font-size:16px; margin:0px;} #menuHolder ul {list-style:none;} #menuHolder ul li {float:left; padding:0px 10px 0px 10px; line-height:60px;} .subHolder {position:absolute; left:0px; top:200px; overflow:hidden; font-size:14px; background:#0083ad;} #menuHolder ul li:hover .subHolder {left:0px; top:60px; width:1000px; text-align:center; height:60px;} #menuHolder ul li:hover {background:#0083ad;} /* sub menu */ .subHolder ul {list-style:none;} .subHolder ul li {float:left; padding:0px 10px 0px 10px; line-height:60px;} .bottom {position:absolute; left:0px; top:500px; overflow:hidden; font-size:12px; background:#0094ad;} .subHolder ul li:hover .bottom {left:0px; top:120px; width:1000px; height:60px; text-align:center; line-height:60px;} .subHolder ul li:hover {background:#0094ad;} /*bottom level*/ .bottom ul {list-style:none;} .bottom ul li {float:left; padding:0px 10px 0px 10px;} |