Is it possible to change the text color with a mouseover effect without using images, just the plain text?
Thank you .... viki barefoot
Printable View
Is it possible to change the text color with a mouseover effect without using images, just the plain text?
Thank you .... viki barefoot
yes you can, however you will need to use a combination of CSS and Javascript. for standards browsers (Basically all BUT Internet Explorer) you can just use the tag, however because IE doesnt support the psuedo selectors for any tag but anchor, you will need to encorporate a javascript hack.
ANCHOR TAG ( <a href=''>...</a> )
put this wherever you need the linkCode:<a class="changeBlue" href="/path/to/file.ext">Link</a>
put this in your stylesheetCode:a.changeBlue:link { /* default link color */
color: #000000;
}
a.changeBlue:hover { /* change to blue on mouseover */
color: #0000ff;
}
NON - ANCHOR TAG
put this in yourCode:<p class="changeBlue">THIS IS SOME TEXT THAT I WANT CHANGED TO BLUE<p>
<body>tag, whereever you want the change to occur.
put this in your css stylesheetCode:p.changeBlue { /* creates the default color as black */
color: #000000;
}
p.changeBlue:hover { /* changes the color of the text to blue on mouseover */
color: #0000ff;
}
put this in yourCode:<script type="text/javascript">
document.getElementByClass('changeBlue').onmouseover.style.color = "#0000ff;';
</script>
<head>tag.
Yes, it is easy. Make sure the text has a class, for example:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style>
.TheTextOff{
color:#ff0000;
font-family:Arial, Helvetica, sans-serif;
font-size:18px;
}
.TheTextOn{
color:#000000;
font-family:Arial, Helvetica, sans-serif;
font-size:18px;
}
</style>
</head>
<body>
<div class="TheTextOff" onmouseover="this.className='TheTextOn'" onmouseout="this.className='TheTextOff'">Some text you want to change color</div>
</body>
</html>