CSS - A:hover Question
Im making a website and i wanted to know if i made a map like:
a.img:hover {img url(image.jpg);} and then back into HTML do this: <a class="hello" href="www.domain.com">Link</a> and then when i hover over the link it will change into a image link? and it dose not work for me. Similar TutorialsHaving trouble with using CSS for email link. The problem is that mouse hover produces a black background - this is the intention. However, after clicking on link to open email client, the link (on that page) doesn't have the balck background effect. Other pages in the site are OK - until I click them once. Am I missing a section from the css file below that would give me the same hover effect even after the action of clicking the mailto: link has been done? Many thanks a:link.link1 { color: #CDBC75; text-decoration: none; background-color: transparent } a:visited.link1 { color: #CDBC75; text-decoration: none; background-color: transparent } a:hover.link1 { color: #CDBC75; text-decoration: none; background-color: #000000 } a:active.link1 { color: #CDBC75; text-decoration: none; background-color: transparent I'm taking a condensed class at the community college here and my final is due tomorrow night. My teacher has a very thick Russian accent and is very difficult to understand, and does not make himself particularly available away from class hours...so...I'm sort of stuck. I understand that this is an embarrassingly basic CSS I've got rigged up here, so I need no critiquing on it, though if you feel you must, go ahead. Anyway, I was finishing the thing up tonight and realized that I missed one of the requirements for this final project (sloppy handwriting =( ). My main question is this: On each page I have a series of thumbnails, and one larger image at left. I would like to (either with addition to the CSS, or with not too much extra addition to each of the thirty some pages) create a hover effect wherein ONLY the larger image at left will load a larger version of the image on mouseover. I found a few examples on CSS tutorial websites but have been unable to correctly apply it. I am really in a jam and would appreciate any help anyone could give me on this. Additionally, (I know this one is really pushing it) I was not able to resize images, as I am on a new machine and a tight budget, so couldn't afford a copy of photoshop. Most of the images are already resized to 600 x 800 (downloaded from my photobucket account onto the new machine after the old died) but a few of them are larger sizes...so on the mouseover, is there a way to constrain all images to their correct proportions, regardless of filesize? I think this might be an impossibility but I thought it was worth the time to ask anyway (e.g. 600 x 800 images that are constrained to a smaller size, will pop over on mouseover to full 600 x 800, while images that may exceed those dimensions would still on mouseover pop over at a maximum of 600 or 800, whichever side is the largest, and the smaller size whatever it should be proportionally)? I know this is really convoluted and probably sounds incredibly dumb, but most of us in the class have essentially self-taught ourselves, given how difficult our instructor is to follow in the classroom, so I've done everything on this project by trying to find examples in a pretty terrible text book. Any help would be hugely appreciated. I am pasting in the CSS sheet, as well as the code for an example page, so that someone might possibly be able to help me correct/add this. If you are able to help, please be as explicit and obvious as possible, because I am having a hard time working this out on my own. CSS: html, body { font: 11px "Arial", Lucida Grande, Verdana, Sans-Serif; margin: 0; padding: 0; } #container { width:800px; margin-left:auto; margin-right:auto; } #header { width:800px; text-align:center; margin-top:5px; margin-bottom:5px; } #header h1 { margin:0; font-size:18px; } #breadcrumb { list-style-type: none; margin:0; padding:0; margin-left:auto; margin-right:auto; } #breadcrumb li{ float:left; color:black; padding-right:3px; } #breadcrumb li a{ text-decoration:none; font-style:italic; color:black; } #nav { list-style-type: none; margin:0; padding:0; } #nav li{ float:left; text-align:center; width:25px; } #nav li#pages{ width:700px; font-size:14px; } #nav li a img{ border:0; } #content { width:800px; } #large-image-frame { width:400px; float:left; } #large-image-box { margin-top:5px; padding-top:10px; width:320px; margin-right:auto; margin-left:auto; background-color:black; padding-bottom:10px; } #large-image-box img{ display:block; margin-left:auto; margin-right:auto; margin-bottom:10px; } #large-image-box span{ font-size: 12pt; display:block; margin-left:auto; margin-right:auto; text-align:center; height:60px; width:300px; background-color:white; } #thumbnail-box { width:400px; float:left; } #thumbnails { list-style-type: none; margin:0; padding:0; float:left; } #thumbnails li { margin:0; padding:0; float:left; } div.small-image-box { background-color:black; width:110px; margin-bottom:10px; margin-left:15px; text-align:center; padding-bottom:5px; padding-top:5px; } div.small-image-box img { margin-bottom:5px; display:block; margin-left:auto; margin-right:auto; } div.small-image-box span { height:10px; width:100px; background-color:white; display:block; font-size:9px; margin-left:auto; margin-right:auto; text-align:center; } #instructions { width:800px; } a:link, a:visited, a:active { text-decoration: none } a:hover { color: black; background-color: white; text-decoration: none; border: 2px solid black; } and the section of code which I would like the mouseover to be effective on: <div id="content"> <div id="large-image-frame"> <div id="large-image-box"> <img src="images/OP06.jpg" width="94%" height="94%" alt="OP06" /> The section in red is where the image is that I would like to be able to mouseover for a larger (approximately 600 x 800 or 600 x _______/ or _____________ x 800, depending on proportions). Again, I'm desperate, and would be super super grateful for any help/pity any of you might toss my way. Thanks. Hey there! I have a question: is it possible to change the properties of OTHER elements, IDs, et cetera when hovering over something else? For example, let's say I have a fieldset, and inside are some fields, and a <legend>. Is it possible to make the legend change color when I move my mouse over the fieldset, and not the legend? This could make for some nice CSS effects. 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 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 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. 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. 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> 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 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 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 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 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; } 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 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 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 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, 1. I am developing website with CSS which is fine to see on my pc for the font ( looks smooth ), but when I upload it on web the font looks rough (looks no smooth).Can you advise? 2. Also some link for Hove and Activate not running well, sometime dissapear or the command from css not running. Is it problem of the way CSS standard format ? may I know the correct CSS standard format to be written ? i wrote like this for example: .menu1 {color :Maroon; font-family: Verdana,Tahoma,Arial,sansserif,Helvetica; font-size:7.5pt; font-weight: bold; text-decoration: none; } .menu1 :hover { font-family: Verdana,Tahoma,Arial,sans-serif,Helvetica; font color:red; display: list-item; list-style: url(../pix/icon_segitiga.gif); } .menu1 :link { font-family: Verdana,Tahoma,Arial,sans-serif,Helvetica; color:Maroon;} .menu1 :visited{ font-family: Verdana,Tahoma,Arial,sans-serif,Helvetica; color:Maroon;} 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 |