CSS - Simple Css Rollover Images Menu Problem
Hi ! Me again :P
So this is a simple test i made to try this out. But I ran into a problem. Take a look for yourself: (view-source for xhtml and css) http://fotoz.hit.bg/test/menu.html The problem is that annoying flickering that happens when you roll over. Any ideas how to fix it ? And most importantly why does it occur? Thanks! p.s I should explain what i wanted to do here. Basicly 1 big background image to the <div>. It will be holding the "over" state of all the buttons. At the same time the <a> elements will be holding images of the "normal" state buttons, and when you hover over them they will disappear and you will see the "hover" state below. It works but I get the flickering with visibility:hidden and even if i just move the img out of the way Similar TutorialsI am trying to create a Horizontal Multilevel Drop Down Navigation Menu, but instead of the css creating text i would like them to be images and when you hover over the links they rollover into a new image. I would really like your help on this been trying to do it for weeks now!! Cheers I am just learning CSS and I found this site and they have a step through example, but I am having problem where they use body.about dt#about, body.about dt#about a, body.services dt#services, body.services dt#services a, body.portfolio dt#portfolio, body.portfolio dt#portfolio a, body.contact dt#contact, body.contact dt#contact a { background-position: 0 -100px; } to select different parts of an image to display. Also, supposedly, you put in the body tag of the index.html file <body class="about"> and it is supposed to use the about image, but I am unsure how to enable the others. Anyone have an idea. The code is too much to post here, but I could possibly email it if anyone needs it. Link: http://ajwells.org/mtmp/index.html How do I get the menu there to center on the screen? Ive tried a number of things and nothings worked as of yet. Or better yet, is there an easy way to make the menu on the left side going downward rather than left to right? Either would be great. thanks for the help. i have a vertical rollover menu which has odd shaped boxes, i'd like these to rollover without hiding those parts of the image that protrude. [IMG](URL address blocked: See forum rules)[/IMG] basically they have to butt up underneath each other, but not loose the outside top edges on the rollover state. i also want the text aligned right, but have a negative indent of 10 or so pixels. you'll see what I mean upon viewing the example. thanks in advance! current CSS; ul { list-style: none; margin: 0; padding: 0; text-align: right; position: relative; } ul a { display: block; width: 141px; height: 44px; line-height: 58px; text-decoration: none; background: url(../images/gif/menuOverA.gif) no-repeat left; } #home #menu .home a, #about #menu .about a, #choose #menu .choose a, #services #menu .services a, #health #menu .health a, #testimonials #menu .testimonials a, #contact #menu .contact a { background: url(../images/gif/menuOverA.gif) no-repeat right; cursor: default; color: White; } #menu a:hover { background: url(../images/gif/menuOverA.gif) no-repeat right; color: White; } #about #menu .about li { background-color: Aqua; } and html; <div id="menu"> <ul> <li class="home"><a href="index.html">HOME</a></li> <li class="about"><a href="aboutUs.html">ABOUT US</a></li> <li class="choose"><a href="whyChoose.html">WHY CHOOSE US</a></li> <li class="services"><a href="services.html">SERVICES</a></li> <li class="health"><a href="healthSafety.html">HEALTH & SAFETY</a></li> <li class="testimonials"><a href="testimonials.html">TESTIMONIALS</a></li> <li class="contact"><a href="contactUs.html">CONTACT US</a></li> </ul> </div> currently at my site i have rollover images on my menu which are gif files and have parallel gif files that are "lit up" which show when the user puts their mouse over the gif which looks very pretty and i like it, unfourtnatly it uses javascript. this creates a couple issues, one is that the user needs javascript for this too work, the other is i think it's casuing my page to load slow. someone said something about doing rollover images with CSS. im willing to try it but i don't understand or have a clue how to do this. also is using CSS any better? (speed wise most importantly) in IE the hourglass flickers...so i need to put a image on it and stuff......should i just overlap the image with negative margin or write text to a picture? Hi, Does anybody know how i can have an image that switches to another image on rollover and also has a link? Thanks hi all, I am trying to figure out how to have multiple CSS Rollover images with links on one page. Any ideas, tips, suggestions or samples are greatly appreciated! Brook I can't seem to find this solution anywhere I want an image rollover with CSS to work in IE, but IE hates me so I can't get it. Here is one of my buttons: CSS: #tab_nav #home_tab { background: url(images/home.jpg) no-repeat; width: 97px; height: 33px; cursor: pointer; } #tab_nav #home_tab:hover {background: url(images/home-over.jpg) no-repeat; width: 97px; height: 33px; } Here is the HTML too in case you want it: <div id="tab_nav"> <div id="home_tab" onClick="javascript:window.location.href='index.php';"></div> </div> Now, the rollover works well in Mozilla, but it doesn't work in IE. Does anyone know how I can acheive this? Thanks BTW, here is the page Hello everyone, I wanted to ask, how to place a text over a rollover image. Most ppl recommend to set the image as background in table or div tag, but that would prevent to make the image a rollover. To put it simply, I want to create an effect, I have seen e.g. at ehow.com When you place your cursor on a button in the menu, the text gets underlined. When you place your cursor on a button in the submenu ("Browse How Tos"), the text gets ubderlined AND the image changes. Is this somehow a combination of rollover text and image? My question basically is: HOW DO YOU CREATE SUCH AN EFFECT? Thank you for your replies, Tomas So, I'm pretty new to all this, and any help is really key. So, on my site, I have a lot of rollover images. I may be breaking usability rules! The site has a lot of hand drawn elements that are supposed to act as nav. So, we implemented hand drawn nav that changes color when you rollover it. The problem is that when you click on those rollovers, a big dotted box appears around the selected one... it looks especially tacky if you don't go over to the next page. All of these elements have this box. Is there a way to tell the browser not to show that selection box?? i have a basic html page which includes a number of hyperlinks using jpeg images... essentially <img> tags wrappped in <a> tags. i want to create a rollover effect with these links so that when a link is highlighted (mouseover) the jpeg image changes to another seperate jpeg impage. is it possible to do this with html/css and if so how can i do this? i have read about a method of doing this which combines both the original image (before mouseover) and the mouseover image into one single jpeg and changing the image's x-coordinate using css so that there is no preload/image flicker issues when the link is clicked on, but i'm not sure exactly how to code this. any help is appreciated. Good day all, I have set up my index page for my site with css rollovers instead of javascript rollovers, and I really like the loading time, the problem that I am having is that when I click on the image rollover link there appears a white box around the image. how can this be avoided? Please see the link below for what I am trying to explain... http://www.karmaimports.net/indexcss.htm thanks in advance... Brook Hey there dev pepz Does anyone know why this little rollover code doesn't work in ie6 but works fine in Firefox? (background changes) PS: Background is originally #777777; CSS: Code: div.cat-div a:hover div.cat-left, div.cat-div a:hover div.cat-right { background:#829DB9; cursor:pointer;} HTML: Code: <div class="cat-div"> <a href="http://domain.com/gallery"> <div class="cat-left">gallery</div> <div class="cat-right">click here</div> </a> </div> Thanks heaps hi, been trying to do this for a few hours now and pretty much struggling a bit. basically I have a <ul> and when I hover the mouse over one of the list links, I wantt a sub menu to appear which can also be clicked. I have trawled around abit to see if I could get anything but have come up empty handed. can someone point me in the right direction here. thanks!! I've finally finished a site, but I am having slight problems with the rollover menu. I was able to post it online, so check out this page, first in Firefox, then in IE. http://uwopartners.org/students/schuhm65/Plexus/main.html I believe the problem is that the conditional IE statements add a table within the main menu links. This is to get around using javascript, but when you hover over the main links, the background is changed and expanded to include the submenu. Can anyone figure out a work around for this, so the appearance is similar to Firefox? Here is the css: Code: html { margin:0; padding:0; } body { margin: 0; padding: 5px; font-family: verdana, arial, helvetica, sans-serif; font-size: 76%; background-color: #eee; color: #000; } .clear { margin:0; padding:0; clear:both; font-size:0; line-height:0; } /* Header container */ #header { margin: 0; padding: 0; border: 1px solid #000; color: #fff; text-align: center; background: url("images/classroom.gif") repeat-x; } img#logo { margin: 10px 0px 0px 0px; border: 4px solid #FFF; } #header h1 { margin: 5px 0px 5px 0px; font-size: 2.5em; font-weight: bold; letter-spacing: 0.125em; } #banner { margin: 0; padding: 0; background: #235 url("images/banner.gif") no-repeat 50% 50%; border: 1px solid #000; } #banner img { width: 0; margin-left: -200px; padding-left: 1px; } /*topNav Container */ #topNav { margin: 10px 0px; padding: 0; /* border: 1px solid #ff0; */ } #searchBox { margin: 0; padding: 0; float: left; width: 150px; height: 125px; border: 1px solid #000; background: #FFF; text-align: center; } #nav { margin: 0px 0px 0px 153px; padding: 0px; /* border: 1px solid #0f0; */ } #nav ul { list-style-type: none; margin: 0; padding: 0; } #nav li#nav-foundation, #nav li#nav-submission, #nav li#nav-recipients, #nav li#nav-volunteer { margin: 0px 0px 0px 8px; padding: 0; float: left; display: inline; width: 23%; height: 125px; border: 1px solid #000; background-repeat: no-repeat; background-position: 50% 100%; } #nav table { border-collapse: collapse; } #nav a.mainMenu { display: block; font-size: 18px; color: #FFF; background-color: #c7013f; text-decoration: none; text-align: center; } #nav ul ul { margin: 0 auto; padding: 0; display: none; width: 90%; /* border: 1px solid #0f0; */ } #nav ul ul li { margin: 4px 0px; padding: 0; border: 1px solid #fff; } #nav table a { font-size: 15px; display: block; color: #fff; text-decoration: none; text-align: center; background-color: #c7013f; } #nav ul ul li a { font-size: 15px; display: block; color: #fff; text-decoration: none; text-align: center; background-color: #c7013f; } #nav ul li:hover a.mainMenu , #nav ul a.mainMenu:hover { background-color: #235; } #nav ul li:hover ul, #nav ul a.mainMenu:hover ul{ display: block; } #nav ul ul li:hover a, #nav ul ul a:hover { background-color: #235; } /* nav Headings #foundation #nav-foundation a.mainMenu, #submission #nav-submission a.mainMenu, #volunteer #nav-volunteer a.mainMenu, #recipients #nav-recipients a.mainMenu { background: #235; } #charter #nav-foundation ul, #committee #nav-foundation ul, #schedule #nav-foundation ul { display: block; } #charter #nav-foundation ul #nav-charter a, #committee #nav-foundation ul #nav-committee a, #schedule #nav-foundation ul #nav-schedule a { background: #235; } */ /* Side Navigation */ #sideNav { float: left; width: 151px; /* 1px adjustment for no border */ margin-right: 10px; } /* sideNav Boxes */ #sideNav .box { margin-bottom: 10px; padding: 5px 5px 5px 50px; border: 1px solid #000; height: 90px; /* add 10 for padding */ background: #235; color: #fff; background-repeat: no-repeat; } #sideNav a { font-size: 1em; color: #fff; text-decoration: none; } #sideNav #calendar { margin: 0px; } #sideNav img { border-style: none; width: 150px; height: 150px; } #sideNav a:hover { font-weight: bold; } /* Main Content Container */ #main { float: auto; padding: 10px; border: 1px solid #000; background: #fff; margin-left: 165px; } /* Page Footer */ #footer { clear: both; background: #235; border: 1px solid #000; color: #aaa; text-align: center; margin: 10px 0px 0px 0px; padding: 20px; } #footer a { color: #fff; font: underline; } #footer a:hover { font-weight: bold; letter-spacing: .1em; } And here is the html: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Welcome!</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link href="style.css" rel="stylesheet" media="screen" type="text/css" /> </head> <body> <!-- Header --> <div id="header"> <span> <img id="logo" src="images/plexusLogo.jpg" alt="Plexus"/>®</span> <h1>Helping Hands</h1> <div id="banner"> <img src="images/banner.gif" width="200" height="30" alt="Providing Resources - Supporting Communities - Affecting Lives"> </div> </div> <!-- Navigation Menu --> <div id="topNav"> <!-- Search Box --> <div id="searchBox"> Welcome, <b>John Doe</b>! [<a href="#">Admin</a>] [<a href="#">Sign Out</a>] <form action="" name="search"> <input type="text" size="14" name="searchQuery" /> <input type="submit" value="Search" /> </form> </div> <div id="nav"> <ul> <li id="nav-foundation" style="background-image: url(images/foundation.jpg)"> <a class="mainMenu" href="#">Foundation <!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li id="nav-charter"> <a href="#">Charter</a> </li> <li id="nav-committee"> <a href="#">Committee</a> </li> <li id="nav-schedule"><a href="#">Schedule</a> </li> <div class="clear"> </div> </ul><!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li id="nav-submission" style="background-image: url(images/submission.jpg)"> <a class="mainMenu" href="#">Submission <!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li id="nav-guidelines"> <a href="#">Guidelines for Giving</a> </li> <li id="nav-submit"> <a href="#">How to Submit a Request</a> </li> <div class="clear"> </div> </ul><!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li id="nav-recipients" style="background-image: url(images/recipients.jpg)"> <a class="mainMenu" href="#">Recipients <!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li> <a href="#">Sub One</a> </li> <li> <a href="#">Sub Two</a> </li> <div class="clear"> </div> </ul><!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li id="nav-volunteer" style="background-image: url(images/volunteer.jpg)"> <a class="mainMenu" href="#">Volunteer <!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li id="nav-program"> <a href="#">Volunteer Program</a> </li> <li id="nav-tracking"> <a href="#">Tracking Hours</a> </li> <div class="clear"> </div> </ul><!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <div class="clear"> </div> </ul> <div class="clear"> </div> </div><!-- nav --> <div class="clear"> </div> </div><!-- topNav --> <!-- Side Navigation --> <div id="sideNav"> <div class="box" style="background-image: url(images/CompanyEvents.gif)"> <a href="#">Check out the events at Plexus!</a></div> <div class="box" style="background-image: url(images/CommunityEvents.gif)"> <a href="#">Check out the community events sponsored by Plexus!</a></div> <div class="box" style="background-image: url(images/EventPhotos.gif)"> <a href="#">Check out the photos from previous events!</a></div> <div class="box" style="background-image: url(images/AddEvent.gif)"> <a href="#">Check out the photos from previous events!</a></div> <div id="calendar"> <a href="#"><img src="images/calendar.jpg"/></a> </div> </div> <!-- Main Content --> <div id="main"> The Foundation's goal is to provide support that can have a meaningful impact in markets and communities that are strategically alligned with Plexus Corp.'s mission as the Product Realization Company. To accomplish this goal, the PCCF's charitable giving is allocated into three primary categories: <br /><br /> <ul style="padding-left: 32px;"> <li><b>1. Technology:</b> Supporting innovation and technology-related education</li> <li><b>2. Healthca </b> Enhancing the quality of medical care</li> <li><b>3. Community:</b> Making the communities we live in a better place</li> </ul> <br />Maecenas ut quam rutrum lacus tempus fringilla. Maecenas aliquam tempus libero. Mauris porttitor. Etiam at risus a est sodales cursus. Cras ut ipsum. Vivamus at turpis ac lorem posuere rutrum. Vestibulum nisi nulla, rhoncus a, rhoncus sit amet, placerat ac, justo. Nam consequat mauris ut orci. Etiam eleifend. Ut sem mauris, imperdiet vitae, consectetuer a, ullamcorper non, nibh. Curabitur sapien. Fusce ultricies, ligula eget scelerisque tempus, nisi nisl convallis dui, ut scelerisque magna est sit amet leo. Suspendisse facilisis tortor faucibus elit. Sed diam. Duis imperdiet blandit mauris. Etiam cursus erat vel ligula. <br /><br />Sed vel urna. Quisque mattis orci sit amet dolor. Sed commodo felis at diam. Aenean ut nisl a mauris varius hendrerit. Vivamus feugiat risus in lacus. Ut eleifend velit. In blandit. Mauris bibendum, nunc at ullamcorper egestas, eros nibh faucibus diam, tincidunt placerat purus justo vel sapien. Curabitur feugiat scelerisque odio. Nullam nec augue ut libero faucibus ornare. Suspendisse tortor mauris, luctus sit amet, tempor vel, facilisis ac, lacus. Phasellus ultrices, massa eget consequat dapibus, dui felis interdum sapien, sed fringilla magna neque eu est. Vestibulum luctus vehicula eros. <br /><br />Phasellus massa metus, blandit eget, porttitor at, faucibus ac, lorem. Integer id augue vitae magna ullamcorper varius. Nam id turpis. Integer venenatis tincidunt est. In hac habitasse platea dictumst. Proin id turpis fermentum neque sodales ullamcorper. Quisque ante. Morbi sit amet quam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc nulla erat, sollicitudin in, imperdiet vitae, elementum eu, sapien. Nulla nonummy nisi eget quam. Suspendisse potenti. <br /><br />Morbi quis enim ac libero pulvinar scelerisque. Morbi eleifend, nulla eget egestas tincidunt, augue libero rutrum neque, non pharetra orci risus vel diam. Nunc eget lorem. Integer vitae erat. Donec non diam. Nulla a risus sit amet orci consectetuer tincidunt. Morbi sapien. Ut scelerisque, ipsum quis egestas blandit, magna nisl laoreet ligula, at ornare lorem augue nec purus. Praesent scelerisque, lectus sed venenatis lacinia, ipsum nulla accumsan nibh, id dapibus lectus libero ultricies ipsum. Etiam aliquet vehicula nisi. Praesent consectetuer, odio eget posuere blandit, dui sapien pharetra enim, id iaculis elit est sed libero. Praesent in eros non augue commodo nonummy. <br /><br />Nulla placerat feugiat neque. Vivamus commodo condimentum neque. Aenean at enim et justo malesuada molestie. Cras lacinia tincidunt magna. Vivamus convallis, tellus nec convallis blandit, diam nisi facilisis justo, ut consectetuer lectus neque et sapien. Quisque mattis dolor vel mi. Aliquam risus odio, euismod at, sodales non, auctor a, leo. Pellentesque imperdiet odio quis velit. Quisque pharetra, quam vel volutpat molestie, mi mauris auctor neque, eget tempus massa nibh vel enim. Donec vitae arcu at pede feugiat suscipit. Quisque sollicitudin. Cras ac enim a lorem nonummy consectetuer. Donec tortor nulla, porttitor mattis, molestie eu, pharetra elementum, libero. Integer nonummy viverra quam. Sed posuere urna non elit. Morbi et sem quis neque tempor tincidunt. <br /><br />Nam velit. Nam eget lectus sit amet nibh aliquam pulvinar. Pellentesque quam. Integer mauris est, dapibus eu, laoreet at, vehicula nec, tellus. Nam urna diam, nonummy ac, dictum ut, accumsan id, orci. Ut iaculis. Praesent sapien quam, vehicula vitae, imperdiet vitae, dictum at, lorem. Morbi nisl purus, interdum nec, sollicitudin at, eleifend vel, sem. Phasellus lacinia. Duis ut ligula. Morbi ut felis ac quam feugiat eleifend. Vestibulum nibh mauris, interdum ac, vehicula a, porttitor accumsan, ligula. Aenean vehicula tortor vel turpis. In hac habitasse platea dictumst. Suspendisse id sem. Sed fermentum, nisi at vestibulum cursus, sem nibh aliquet arcu, non vehicula turpis felis et dui. Pellentesque ligula augue, hendrerit quis, rhoncus vitae, hendrerit fringilla, nibh. </div> <div id="footer"> <a href="#">Feedback</a> | <a href="#">Contact</a> | <a href="#">Site Map</a> | <a href="#">Privacy</a> | <a href="#">Legal</a> <br /><br /> Donec aliquet tincidunt velit. Aliquam erat volutpat.<br /> Mauris ante. Suspendisse a leo ut leo tristique porta.<br /> Aliquam iaculis sem tristique massa fringilla faucibus. </div> </body> </html> Hello guys Please see the attached .zip, it contains a .swf file which shows what I am trying to accomplish in css, and a html file with the progress i've made. I would like there to be no images involved. I have been trying for a good few days now. I can almost get it to work in IE (Except the 1px gap between button and end-block), but in other browsers its just not working. Any help is greatly appreciated, Cheers, Rob Ok ive never really used this effect on any of my designs but i would like to. How do i make a <td> background color change on mouse over with css?? and also how would i align an image to the bottom right or bottom left part of a paragraph, i allready know how to do it to the top right and top left. thanks in advance. I am not liking CSS atm. I have spent nearly 3 hours actually on trying to get a rollover to work. I've tried a IRC channel but all the help I've gotten is how to do a image rollover with one image and/or with text. Here is all I want. It's very simple. I want to have a image rollover (the image changes when the mouse moves over it) for several different images. I want to do it in CSS. Code: #seeallseries { background: url('navpictures/seeallseries.gif') no-repeat; width: 171px; height: 55px; display: visible; } #seeallseries:hover { background: url('navpictures/seeallseriesHover.gif') no-repeat; width: 171px; height: 55px; display: visible; } That's my CSS code that I have right now. How do I use that to make a image rollover. I can do Code: <div class="navbar"> <ul id="seeallseriesul"> <a href="http://www.google.com"><li id="seeallseries"></li></a> </ul> </div> Ignore the other CSS code for the moment. Right at that, it works. The image rollover happens. However I need a link which that does not provide. Is what I'm trying to do impossible? Please tell it's not. This should be simple but it's not for me. Thanks for any links or help. I'm having a problem getting the text of an <a> tag to be what I want where I want. No one in the javascript forum wants to tackle this. maybe it is a css thing. I made this interlocking tabbed menu which I do by javascript updating the position of the background graphic and its neighbor. I have done buttons before with a background and text overlayed. but they were always <input>'s and whatever I put in the value field just kinda showed up on top of the background graphic. These are actually <a>'s I assumed the text I put in between the <a> and the </a> tag would just show up but it doesn't. I tried making special divs for them but then I run in to position problems. If I make it absolute the first one is fine, then they all pile on top of it. If I make it relative, NONE of them show. Here is a test http://colleenweb.com/tests/bartest.php There is nothing like css for turning my brain into industrial waste. This has to be doable. Someone who understands this stuff please advise? |