PDA

View Full Version : Text hover color on text with on link


lux
05-31-2006, 05:21 PM
Hey,

i was hoping to find out whether it is possible to change the colour of text when the pointer hovers over it, but not when the text is a link to another page or is an anchor.

Thanks

cperkins
06-01-2006, 02:42 AM
Yes,

The simplest solution is to use an <a> tag, but set its href to nothing ( <a href="#">....)


If you really cannot use the <a> tag, then you can still do hovers over other objects in almost all browsers except IE 6 for Windows.

Internet Explorer 6 will only do CSS hovers on <a> tags. But the other browsers will let you do something like this:

/* some CSS */
.hoverlicious { color: #000000; } /* black in the normal state*/
.hoverlicisou:hover { color:#FF0000; } /* red on rollover */

....

<span class="hoverlicious">text that has hover, but is not a link</span>




Lastly, if you really need this to work in IE, and you really cannot use an <a> tag with a # link, then I believe you can use javascript. Though, I'm not 100% certain about this working in IE6.


Hope this helps,

Chris Perkins
http://www.medialab.com/sitegrinder <- Photoshop to the web plug-in. Stop slicing, stop copy/pasting, start being productive. Go right from Photoshop to DreamWeaver with styled text intact, XHTML 1.1 valid markup and more. Version 2.0 just released - check out support for email forms from Photoshop and more.

http://ww.medialab.com/wellrounded <- DreamWeaver extension for making round cornered rects. Supports liquid layout, borders, drop shadows, inner shadows, and more. XHTML 1.1 valid and CSS.

lux
06-01-2006, 09:12 AM
Hey,

Thanks for the quick responce. Ill test out the <a> tag solution.

Wicked