CSS - Css/javascript - Javascript Hover Not Working Correctly.
Hi,
First, I'm using the javascript/tutorial from http://www.htmldog.com/articles/suckerfish/dropdowns/ Visit http://serve5.net/xcage/nav/ . The spacing inbetween each image is fine, it's how I want it to be. However, view it in Mozilla first then in IE. Notice something? In Mozilla it does what it's supposed to correctly - have the 'main' background turn blue, and the sub-menu background turn green. However, in IE, this makes BOTH the 'main' and sub-menu background green, instead of keeping the main one blue. I have tried for the past 15 minutes trying to figure this out, but came up empty. I believe it's a problem in the javascript hover code, located in sfhover.js.... since that's what controls IE's hover and it works fine in Mozilla Could you look at the code and tell me whats wrong? http://serve5.net/xcage/nav/ http://serve5.net/xcage/nav/styles/xcage.css http://serve5.net/xcage/nav/scripts/sfhover.js Thanks. Similar TutorialsHello I'm a photographer trying to code my site myself, I'm a control freak and trying to learn css but coding is not my thing. I have two different rollover effects on my page but only one part is working. The links on the right of photo function correctly when I hover over them, but the links on top don't change as they should. a link to my css file Can anyone help me on this? I believe i have the order correct (a:hover follows link and visited) but i'm sure it's an easy fix. Sadly, not for me. Thanks for any help here is my site: chrisziebarth dot com/test My css file is located in /style.css Hi Everyone, I am working on redesigning a website in WordPress that I had previously built in HTML. Most things seems to be working well, except some styling of some JavaScript. The script has a special hover image, but in the new site I can't get the descriptions to be inside the hover box. You can see an example of the old, correctly working site he e3ncw [dot] com And the new, broken one he e3ncw [dot] com /page/1 If you hover over any button in the sidebar you'll see the problem. I'm using float:left on both the image and the description, but can't get it to work. Here's the current CSS I'm using: Code: .sb-blocks li em { background: url(images/hover.png) no-repeat center top; width: 350px; height: 200px; position: absolute; top: 0px; left: -100px; padding: 5px 0 0; font-style: normal; z-index: 2; display: none; } p.url { font-weight: bold; color: #a82125; text-align: center; font-size: 1em; line-height: .5em; } .sb-blocks em img { float: left; padding: 5px 5px 15px 15px; } .sb-blocks p.description { color: #a82125; float: left; width: 275px; } Any help is greatly appreciated. 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 redesigning a web application . I want to introduce color themes in it. When i click on a particular theme i want a new look to appear including buttons. For this i m using the below css code which uses only 3 button images(single image sliced in 3)wherin only the background color is to be changed thru css and new button gets created. Code: body { margin: 0; padding: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; } .btn { float: left; clear: both; background: url(images/btn_left.png) no-repeat; padding: 0 0 0 10px; margin: 5px 0; } .btn a{ float: left; height: 40px; background: url(images/btn_stretch.png) repeat-x left top; line-height: 40px; padding: 0 10px; color: #fff; font-size: 1em; text-decoration: none; } .btn span { background: url(images/btn_right.png) no-repeat; float: left; width: 10px; height: 40px; } .btn_addtocart { background-color: green; } HTML code: <div class="btn btn_addtocart"><a href="#>Submit</a><span></span></div> <div class="clear"></div> Background Color: Red For eg in a login screen The earlier web application used: <input type="image" onclick="javascript:return validate()> wherin the validate function includes Code: function validate() { var user = document.login.loginid.value; var pwd = document.login.loginid.value; if(document.login.loginid.value.length==0) { alert("Enter user name"); return false; } if(document.login.password.value.length==0) { alert("Enter password"); document.login.password.focus(); return false; } return true; } I am not able to use javascript:return validate() with this new html code i.e. <div class="btn btn_addtocart"> <a href="#>Submit</a><span></span></div> <div class="clear"></div> Background Color: Red Please help me with a similar css to run the above javascript or an alternative javascript to run the above css code. Hello, I am a javascript noob trying to do a javascript dropdown and this does not seem to be working at all. When ever I add in the list for the drop down, everything gets pushed to the left and where ever the list begins, every link after that just disappears. I'm pretty sure the link is being put inline instead of block like I wanted it to but i'm not sure how to correct it and I am getting completely frustrated doing it. I was wondering if anyone could tell me what I was doing wrong. Also, I used the suckerfish method for the drop down. HTML Code: Code: <div id="nav"> <ul> <li><a href="agency.html"id="nav_agency" class="" title="Agency">AGENCY</a></li> <li><a href="services.html"id="nav_services" class="active" title="Services">SERVICES</a></li> <li><a href="technology.html" id="nav_technology" class="" title="Technology">TECHNOLOGY</a></li> <li><a href="distribution.html" id="nav_distribution" class="" title="Distribution">DISTRIBUTION</a></li> <ul id="break"><li id="first"> <li><a href="case_studies.html" id="nav_casestudies" class="casestudies" title="Case Studies">CASE STUDIES</a></li> <li><a href="#" id="nav_blog" class="" title="Blog">BLOG</a></li> <ul> <li><a href="#">Search Engine Marketing</a></li> <li><a href="#">Pay Per Click Management</a></li> <li><a href="#">Lovcal Search Marketing</a></li> <li><a href="#">Contextual Marketing</a></li> <li><a href="#">Shopping Comparison</a></li> <li><a href="#">Paid Inclusion</a></li> <li><a href="#">Search Engine Optimizaiton</a></li> </ul> </li> </ul> </ul> </div> [\code] JavaScript Code: [code] startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("break"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; Here is the part of the css I created but i'm not sure how it's all supposed to go together since I'm a javascript noob. CSS: Code: li#first { border-left-width: 1em; } li#last { border-right-width: 1em; } li ul { display: none; position: absolute; top: 100%; float:right; font-weight: normal; padding: 0.5em 0 1em 0; border-right: solid 1px #7d6340; } li>ul { top: auto; left: auto; } li li { display: block; float: none; background-color: transparent; border: 0; } li:hover ul, li.over ul { display: block; } #break a { font-weight: bold; color: green; } #break a { text-decoration: none; } #break li li a { display: block; font-weight: normal; color: #060; padding: 0.2em 10px; } #break li li a:hover { padding: 0.2em 5px; border: 5px solid #7d6340; border-width: 0 5px; } #nav{ float:left; width:100%; margin:0px; padding:0px; margin-top:-8px; } #nav ul{ float: right; list-style-stype:none; margin:0px; padding:0px; height:27px; overflow:hidden; } #nav ul li{ display: inline; margin: 0px; padding: 0px; height: 27px; overflow:hidden; } #nav ul li a, #nav ul li a:visited{ background-position: centertop; background-repeat:no-repeat; display:block; float: left; height: 0px; margin: 0px 0px 0px 8px; overflow: hidden; padding: 30px 0px 0px 10px; text-decoration:none; } #nav ul li a:link#nav_agency, #nav ul li a:visited#nav_agency { background-image:url(images/agency2.gif); border:0px; width:54px; } #nav ul li a:hover#nav_agency, #nav ul li a:link#nav_agency.active, #nav ul li a:visited#nav_agency.active { background-image: url(images/agencyup2.gif); border: 0px; width: 54px; } #nav ul li a#nav_services, #nav ul li a:visited#nav_services { background-image: url(images/services2.gif); border:0px; width: 56px; } #nav ul li a:hover#nav_services, #nav ul li a#nav_services.active, #nav ul li a:visited#nav_services.active { background-image: url(images/expandedservice2.gif); border: 0px; width: 56px; } #nav ul li a#nav_technology, #nav ul li a:visited#nav_technology{ background-image: url(images/technology2.gif); border:0px; width: 76px; } #nav ul li a:hover#nav_technology, #nav ul li a#nav_technology.active, #nav ul li a:visited#nav_technology.active { background-image: url(images/technology2up.gif); border: 0px; width: 76px; } #nav ul li a#nav_distribution, #nav ul li a:visited#nav_distribution { background-image:url(images/distribution2.gif); border:0px; width: 72px; } #nav ul li a:hover#nav_distribution, #nav ul li a#nav_distribution.active, #nav ul li a:visited#nav_distribution.active { background-image: url(images/distributionup2.gif); border: 0px; width: 72px; } #nav ul li a#nav_casestudies, #nav ul li a:visited#nav_casestudies { background-image: url(images/casestudies2.gif); border:0px; width: 72px; } #nav ul li a:hover#nav_casestudies, #nav ul li a#nav_casestudies.active, #nav ul li a:visited#nav_casestudies.active { background-image: url(images/casestudiesup2.gif); border: 0px; width: 72px; } #nav ul li a#nav_blog, #nav ul li a:visited#nav_blog { background-image: url(images/blog2.gif); border:0px solid black; width: 27px; } #nav ul li a:hover#nav_blog, #nav ul li a#nav_blog.active, #nav ul li a:visited#nav_blog.active { background-image: url(images/blogup2.gif); border: 0px; width: 27px; } I can hardly believe my eyes. Maybe I'm doing something wrong... I have a div with 5px borders and 5px padding on each side. My php does a browser detect, and pulls the appropriate css file. In the IE stylesheet, I have the div's width set to 820px (800px + 5px + 5px +5px + 5px = 820px) as described as part of the Tan Box Hack (which wasn't working right for some reason). In the Mozilla stylesheet, I have the width set to 800px, because, well, that's how wide it's supposed to be. Now, when I open IE6 and Firefox, and send them both to the page, IE renders the box somewhat larger than the box in FF. What's even stranger is, when I set the width in the IE stylesheet to 800px, it renders correctly, matching the width rendered by FF. Any thoughts on this? I can post my code if you really wanna see it, but I figured you'd all understand what I'm trying to describe... Is there any way to use multi level drop down menus that work on all browswers(IE 6 and 7, firefox, safari) without using .htc file or javascript included? This is nice, but the css in too messy. http://www.bluescopesteel.com If you have any betterones please tell me. Cheers Maybe I'm just missing something here, but I can't get the right column of the search box to align at the top. At first I thought it had something to do with the specified widths, but that did not work. I'm sure this is a quick fix, I can't seem to figure it out though. Thanks. The site Code: <div id="searchbox"> <h2 id="searchbox_header">Browse Bus Rates and Amenities</h2> <p style="padding-left: 5px; ">Search by Bus Type:<br /> <select name="bustype"> <option selected value="">All Bus Types</option> <option value="1" >Deluxe Motor Coach</option> <option value="7" >Double Decker</option> <option value="4" >Entertainer</option> <option value="5" >Executive</option> <option value="9" >Limo Bus</option> <option value="2" >Minibus</option> <option value="3" >School Bus</option> <option value="0" >Tour Operator</option> <option value="6" >Trolley</option> <option value="8" >Van</option> </select></p> <p style="padding-left: 5px; ">Departure State / Province:<br /> <select name="state" onChange="buildCity('','');"><option selected value=""> - No state selected - </option> </select></p> <p style="padding-left: 5px; ">Departure City / Metro Area:<br /> <select name="city"> <option value="">Entire State</option> </select></p> <div id="searchboxrightcol"> <p>Or search by Zipcode:<br /><input type="text" name="zip" size="15"></p> <p>Browse local rates & inventory. Locate specific bus types</p> <p><a href="#">Search</a></p> </div> <div id="searchbox_footer"> <p>BusRates.com does its best to screen out brokers but cannot guarantee this.</p> </div> </div> CSS: #searchbox { width: 400px; margin: 0; padding: 0; border: 1px solid #003366; background: #CCCCFF; } #searchboxrightcol { padding: 0; margin: 0; margin-left: 170px; padding-left: 5px; } #searchboxleftcol { width: 160px; float: left; padding: 0; vertical-align: top; border-right: 1px solid black; } #searchbox p { padding-left: 5px; padding-right: 5px; width: auto; height: auto; } #searchbox_header { text-align: center; color: white; background: #003366; padding: 0px; margin: 0px; width: auto; } #searchbox_footer { width: 400px; text-align: center; color: black; padding: 0px; margin: 0px; } #searchbox a, #searchbox a:visited { background: #336699; text-align: center; padding: 5px 50px 5px 50px; border: 2px solid #003366; color: white; font-weight: bold; text-decoration: none; } #searchbox a:hover { background: #FC7400; text-align: center; padding: 5px 50px 5px 50px; border: 2px solid #003366; text-decoration: none; font-weight: bold; } Hello everyone, Thanks in advance for any help you can offer. I have a single page for a site I'm creating located he simplethoughts.com/test/index.html The css file for the page is located he simplethoughts.com/test/css/screen.css The main navigation is using suckerfish style dropdowns which work fine in IE7, firefox, and opera. However, when I try the page in IE6 or 5.5, the dropdowns 'drop' about 100px too low and WAY to the right of where they're supposed to and I can't seem to figure out why. Thanks again for any help...it's extremely appreciated! -Neil I uploaded the page I am working on to http://sulley.dm.ucf.edu/~ebuccianti/wtf/. I want that text at the top of the page to begin a certain number of pixels down from the top of the div, so I tried to set padding-top to that number of pixels, but for some reason Firefox is extending the bottom of the div by that number of pixels as well. I have done this before and I have never had this problem. What the hell am I doing wrong this time?? Download the page he http://sulley.dm.ucf.edu/~ebuccianti/wtf/index.php Download the stylesheet he http://sulley.dm.ucf.edu/~ebuccianti/wtf/style.css Please help! I am using a transparent png file for a background, obviously this will not work in IE so I am using the AlphaImageLoader hack. Unfortunately I am not sure why but the results are not as expected. Here is my CSS: PHP Code: .wrap[class] { margin-left: auto; margin-right: auto; margin-top: -21px; width: 760px; top: 21px; min-height: 100%; position: relative; left: 0px; background-image: url(../images/content_bg.png); text-align: left; } * html .wrap { height:100%; padding-bottom: -20px; margin-left: auto; margin-right: auto; margin-top: -21px; width: 760px; top: 21px; min-height: 100%; position: relative; left: 0px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='../images/content_bg.png'); text-align: left; } The first attachment is IE and the second is Firefox (the correct one). I can't seem to find out how to solve this. Some reason, the body/html/whatever the hell IE uses as its root, doesn't auto-expand past 100%, meaning vertical scrolling can't occur. What could be going wrong here? Attached is html and css, the relevant css is at top, and is readable, the unreadable css isn't relevant Hello, I'm having a problem getting my drop-down to appear in IE7. Works in IE8. Any suggestions? http://www.mo-pca.org Thanks, -Jamie A few people seem to have had the problem of the a:hover not working right in ie when applied to images. Mine is just applied to a standard bit of text. In my menu (CSS only, no javascript) the descriptions are "display:none" in the initial "a" state and then "display:block" in the a:hover state. Works in Firefox, but not ie. Any ideas? My page is at www.prioritypie.f2s.com/KSA/about.htm You can see the CSS by clicking on the first link on the left hand side of the page. Thanks to anyone who can take away the pain and swearing of the last couple of hours. i am having trouble with a hover button. it works fine in just an HTML page but when i put it on a CSS & php page nothing happens when i hover over it can anyone advise me on how to resolve this please.....thank you here is the code i am using for the button.... Code: <a href="productinfo.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Add Button','','images/buttons/infoover.jpg',1)"><img src="images/buttons/info.jpg" name="Add Button" width="32" height="31" border="0"></a> Thanks in advanced to any replies RF why won't this work on internet explorer a:hover img { }. This is exactly what i'm using, it works on firefox but doesn't work on IE. You can see it in action here. Code: a:hover img { border: 2px solid #fff; } Am trying to solve an annoying IE problem: I have a menu which I has a background image which should appear when rolled over. Unfortunatly this works on Firefox but not IE. In internet explorer, nothing changes when the menu item is rolled over ( hovered ) .. any ideas? The code is: Code: #item, #item2, #item3, #item4 { height:24px; width:147px; border:1px solid #dddddd; padding-top:14px; padding-left:15px; } #item:hover, #item2:hover, #item3:hover, #item4:hover { color:white; } #item:hover { background-image:url(homeRollover.png); } #item2:hover { background-image:url(aboutusRollover.png); } #item3:hover { background-image:url(servicesRoll.png); } #item4:hover { background-image:url(contactusRoll.png); } Hi all, I have this piece of coding (which I'm pretty new at) that allows a "display:none;" span to appear on a link:hover. It works great in Firefox, but I can't for the life of me find why it isn't working in IE. I did this once with an Unordered List and it worked in IE, but now that I have used a table to structure the menu, it isn't working. here is the site: magicbeanz.blogsome.com I've attached the style sheet and html to this post. The relavent coding should be near the bottom. See #catmenu and the #books, #movies, #other, #hobbies, #games, divs. I really hope someone can help. Thanks in advance!! Oh, and I wouldn't mind some feedback on the coding and design. I'm back to working on my skills after a long break >< I have my links, and a:hover does not activate when the link has been visited. Is there any special for a hover visted link or any way to fix this? Whew, it's been a while sin'ce i've been here. Thanks in advance! ~Brendan Hi, I am trying to make a dropdown menu by using only CSS and no Javascript. Here is my HTML Code: <ul id="nav"> <li> <a href="/family-flowers.html"><span>Family Flowers</span></a> <ul> <li> <a href="/family-flowers/anniversary-flowers.html"><span>Anniversary Flowers</span></a> </li> <li> <a href="/family-flowers/birthday-flowers.html"><span>Birthday Flowers</span></a> </li> <li> <a href="/family-flowers/christmas-bouquets.html"><span>Christmas Bouquets</span></a> </li> <li> <a href="/family-flowers/new-baby.html"><span>New baby</span></a> </li> </ul></li> <li class="level item-2 nav-congratulation"> <a href="/congratulation.html"><span>Congratulation</span></a> </li> <li class="level item-3 nav-corporate"> <a href="/corporate.html"><span>Corporate</span></a> </li> <li class="level item-4 nav-get-well"> <a href="/get-well.html"><span>Get Well</span></a> </li> <li class="level item-5 nav-love"> <a href="/love.html"><span>Love Bouquets</span></a> </li> <li class="level item-6 nav-mixed"> <a href="/mixed.html"><span>Mixed</span></a> </li> <li class="level item-7 nav-monthly"> <a href="/monthly.html"><span>Monthly</span></a> </li> <li class="level item-8 nav-funeral"> <a href="/funeral.html"><span>Funeral</span></a> </li> <li class="level item-9 nav-window"> <a href="/window.html"><span>Window plants</span></a> </li> </ul> and this is my CSS Code: #nav { list-style:none; margin:0; padding:0; width:150px; } #nav li ul { position: absolute; left: 149px; top: 0; display: none; } #nav li a { display: block; text-decoration: none; color: #777; background: #fff; padding: 5px; border: 1px solid #ccc; border-bottom: 0; } /* Fix IE. Hide from IE Mac \*/ * html ul li { float: left; } * html ul li a { height: 1%; } /* End */ #nav li:hover ul { display: block; } everything is fine, only on my hovering, the sub UL is not displaying even i made it to display as BLOCK on hover. can anybody help with this please? thank you very much [edit] in fact it is working in FF but not in IE [/edit] |