CSS - How To Create A Hover Effect In Css
I just got done with the second CSS tutorial for today.
Please drop a comment telling me what you think. http://www.majd-gfx.com/tutorials.php?cmd=view&cat=css&id=16 Similar TutorialsIm trying to a hover effect with css kinda like the one here http://tabbywrocks.tumblr.com/ on images. i was wondering if anybody could give me a site to some example code that i could look at or something. i looked a bit myself but i couldnt find anything that had exactly what i wanted. Im hoping you don't need JavaScript for it but i think you might I'm trying to have a hover effect on a link within a <td> tag. In firefox it works fine, but in IE it's not working. I wasn't sure if there's a special property in CSS to get it working. My CSS code is: Quote: .leftblock a{display: block; border-top: 1px solid #ffffff; font-weight: bold; color: #21536A; text-decoration:none; background-color:#CCCCFF; } Quote: .leftblock a:hover{border-top: 1px solid #cccccc; background-color: #DDEEFF; font-weight: bold; text-decoration: none; } I added display:block to the a:hover class as well to try that to no avail. http://www.sassyproducts.com/hover.php is where you can see what I'm working on. If you hover over anywhere on the first link, Fundraising, it adds the hover effect, but the other ones will only show the hover effect if you hover over the text. This is in IE. In FF, it works properly. Any ideas what I may need to add or change?... Thanks. Having 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 Hello, First, I am new to webcoding so I apologise if what I am asking is too stupid. I am doing a little navigation bar for my blog with the hover effect. My problem is that the hover effect only work when I use {display: block;} but I need it to be inline, because when doing {display:block} it displays vertically. However when I do {display: inline-block;} the list items do show up inline horizontally but they show up only as images, neither does the hover effect or the links work. Second, in IE and in chrome it displays differently. Thank you very much for all the help! Also, here is the code! CSS #header-wrapper2{ height:80px; width:580px; margin:0; float: right; background-color: #000000; } #header-wrapper2-navbar{ height: 40px; width: 243; margin-top:40px; margin-left: 3px; padding:0; } #header-wrapper2-navbar li{ margin:0; padding:0; } #header-wrapper2-navbar li,#header-wrapper2-navbar a{ height: 40px; display: block; } #news{ left:0px; width:78px; background: url('') 0 0; } #news a:hover{ background: url('') 0 -44px; } #products{ left:78px; width:88px; background: url('') -78px 0; } #products a:hover{ background: url('') -78px -44px; } #about{ left:166px; width:77px; background: url('') -166px 0; } #about a:hover{ background: url('') -166px -44px; } HTML <div id='header-wrapper2'> <ul id='header-wrapper2-navbar'> <li id='news'><a href='()></li> <li id='products'><a href='></li> <li id='about'><a href='></li> </ul> </div> I've been getting quite confused as to why some CSS wasn't doing what I'd expected it to do. I have code like this: Code: .tBox { width: 50px; height: 50px; } .tHeader { opacity: 1 } .tBox:hover .tHeader { opacity: 0.5 } I then have my DIVs like this (simplified) Code: <div class="holder"> <div class="section1"> <div class="tBox"> </div> </div> <div class="section2"> <div class="tHeader"></div> </div> </div> So what I was expecting to happen is that when someone hovered over "tBox" then "tHeader" would switch opacity. But it wasn't. And I believe this is because tBox and tHeader aren't in the same parent. I read somewhere something about using a "+" to do some special selector stuff in the CSS but didn't really understand. Can someone please help me with how I can get this to work outside of them sharing their parent. Thanks. I'm the processing of redesigning a website that uses hover effect on a button (like button images changes when you put your mouse over it and when you click it, it goes to a different page). Now that works fine if you're on a a desktop/laptop computer. But on a tablet, the hover/onmouseover effect does not work. On a tablet, when clicking the button image, it changes briefly and then immediately goes to a new page. What are methods and techniques where a website can detect if a visitor comes from a tablet or not? Then would it be possible to switch to a tablet CSS version? Or, are there tablet framework (i.e. Modernizer?) that can help with this process? Hi there, I am trying to acheive an effect like the image below.. so when the link is hovered on, there is a light gray bg, but with a 1px space above and below the bg. This is my CSS I have, but it is displaying what looks like a 2px border because my link has a top and bottom gray border. Any ideas how I can acheive this effect? PHP Code: #categories_home a{ background-image: url('images/nav_arrow.gif'); background-repeat:no-repeat; background-position:left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #6dbd00; text-decoration: none; padding: 2px 2px 2px 25px; border-bottom: 1px solid #ececec; border-top: 1px solid #ececec; display:block; } #categories_home a:hover{ background-image: url('images/nav_arrow.gif'); background-repeat:no-repeat; background-position:left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #6dbd00; text-decoration: none; display:block; padding: 2px 2px 2px 25px; background-color: #f6f6f6; border-bottom: 1px solid #ffffff; border-top: 1px solid #ffffff; } i have the following css: Code: .table1 { border-collapse: collapse; width: 50%; margin: 24px; font-size: 1.1em; } .table1 th { background: #3e83c9; color: #fff; font-weight: bold; padding: 2px 11px; text-align: left; border-right: 1px solid #fff; line-height: 1.2; } .table1 td { padding: 6px 11px; border-bottom: 1px solid #95bce2; vertical-align: top; } .table1 td * { padding: 6px 11px; } .table1 tr.alt td { background: #ecf6fc; } .table1 tr.over td, tr:hover td { background: #bcd4ec; } However all tr and td's now getting a hover effect. i tried several methods but I'm to unpracticed with css. Grtzz whitehat I am not sure if this is being done with CSS or JavaScript but I am hoping someone can post how to get effect found on the abduzeedo site. Each time you click a link it dips. Here is the address http://abduzeedo.com/ Thanks James Hi there, I have a table which I want to have a background color on hover. I have tried this: PHP Code: <table style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #888888" width="100%" border="0" cellspacing="0" cellpadding="8"> <tr style="color: #FF7D13;" bgcolor="#f1f1f1"> <td width="25%"><strong>Header 1</strong></td> <td width="25%"><strong>Header 2</strong></td> <td width="25%"><strong>Header 3</strong></td> <td width="25%"><strong>Header 4</strong></td> </tr> <div class="spec" onclick="location.href='#';"> <tr bgcolor="#f1f1f1"> <td width="25%"><strong>Designers</strong></td> <td width="25%">1</td> <td width="25%">2</td> <td width="25%">3</td> </tr> </div> </table> I have given a class to "spec" with a background color, but it doesn't work. Any ideas what is wrong? Hi there, I am trying to create a link which will have a bacground colour appear "around" it when on hover. I currently have a background image, but I tried adding a margin with a background color, but it is not working. This is my code: PHP Code: a.button{ background-image: url('img/button.png'); height: 22px; width: 210px; font-family:Arial, Helvetica, sans-serif; font-size: 14px; color: #ffffff; text-decoration: underline; padding: 3px 0 0 5px; margin: 20px; } a.button:hover{ background-image: url('img/button.png'); height: 22px; width: 210px; font-family:Arial, Helvetica, sans-serif; font-size: 14px; color: #ffffff; text-decoration: underline; padding: 3px 0 0 5px; margin: 20px; background-color: #f6f6f6; } Any ideas how I can acheive this? Thanks i know this is probably a really simple question but i cant think straight and why i cant work it out. when the person hovers over this image i want it to display a border or a certain colour. Code: #buildings { height:195px; width:280px; float:left; margin-left:155px; margin-top:45px; } thats my css i have for this image: Code: <div id="buildings"> <a href="Buildings.php"> <img src="Menu_Images/Buildings.png" width="280" height="195" alt="Buildings" /></a> </div> what would i need to do do ive tried a hover: but that didnt seem to work I followed the online examples pretty closely but for some reason the effect isn't working how it is supposed to. You'll see what i mean he http://www.mr-danny.com/example.html could anybody tell me what i'm doing wrong? Code: <html> <head> <style type="text/css"> ul#menu{ position:relative; top:163px; left:405px; display: inline; list-style: none; list-style-type: none; margin: 0; padding: 0; } ul#menu li{ display:inline; list-style-type:none; } ul#menu li ul.submenu{ display:none; } ul#menu li ul.submenu li{ display:block; } ul#menu li:hover > ul.submenu{ display:block; } </style> </head> <body> <ul id="menu"> <li class="home"><a href="" title="">Heading 1</a></li> <li class="services"><a href="" title="">Heading 2</a> <ul class="submenu"> <li><a href="" title="">sub 2-1</a></li> <li><a href="" title="">sub 2-2</a></li> </ul> </li> <li><a href="" title="">Heading 3</a></li> <li><a href="" title="">Heading 4</a> <ul class="submenu"> <li><a href="" title="">sub 4-1</a></li> <li><a href="" title="">sub 4-2</a></li> </ul> </li> <li><a href="" title="">Heading 5</a> <ul class="submenu"> <li><a href="" title="">sub 5-1</a></li> <li><a href="" title="">sub 5-2</a></li> </ul> </li> </ul> </body> </html> i know that IE doesnt support the :hover being added to anything but links, is this the same with :active? was just wondering whether i could have a style change when the user clicks on a form button 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'm perplexed. I have a div, Code: <div class="classname"> containing a table in muliple pages. I tried applying css style to the div using .classname{ css }, backgroundcolor took affect but color and font-size didn't, its works on others pages though. So I tried Code: <table style="color: red; font-size: 12px;"> This worked! I can't understand why the css would not affect the div itself. Talk about annoying. If anyone has any possible explanations, I'd like to hear. css are assigned to individual div's. body has backgroundcolor only. The url has been blocked? So I'll try this way: spidersandmilkdotcomforwardslashspiderdotcss can some one please help me out in creating that red areas... is any method possible using CSS tht cutting border margin effect... or is using a image the only option. even with using image. how can i get the right side one ? the corner part where its cut cross .. Along the left side of bing are some text links in a table cell. When bing loads you can see a semi-transparent block to give the text contrast if the background has a light color. Also, there is a rollover effect that shades the text. 1. How do I get the semi-transparency? 2. how do Iget the rollover effect? The web page that I am having a problem editing is: www dot postalstampssale dot com We are having a problem getting the mouse over effect on the three (3) jpg images in the upper right hand corner. We have added the appropriate CSS mouse over coding just under the <TITLE> are on the top. We have a;sp added the CSS coding at the end of the page. However, we can not figure out how to attach the proper coding to each image. The current coding is: <img src="Images/Canada/Canada_Scott_356_Front.jpg" width="90" height="60" alt="" border="0" align="right"> <img src="Images/Germany/Germany_Scott_65.jpg" width="89" height="62" alt="" border="0" align="right"> <img src="Images/Bermuda/Bermuda_Scott_55.jpg" width="54" height="64" alt="" border="0" align="right"> Can someone please suggest how to modify the above coding. Thank you in advance. |