onmouseover effects for body text

  • Thread starter some dude somewhere
  • Start date
S

some dude somewhere

Hi there,

I know how to make hyperlinks different with all kinds of text decorations.
But is there also a way to change the color of your text (plain body text,
NO hyperlinks)?

So when your mouse hovers over a textfield (tabel), the font color will
change?

Thanks for any advice or help,

Eric
 
T

Toby A Inkster

some said:
But is there also a way to change the color of your text (plain body text,
NO hyperlinks)?

The neat way to do this is to use CSS. In your style sheet, put say:

..magic:hover {
background-color: #004;
color: #FFC;
}

and then in your HTML:

<p>Here is a paragraph with some <span class="magic">magic text</span>.</p>

However, this doesn't work in Internet Explorer (only in Netscape>6 and
Opera>7). If you want IE support, do the same as above but then add some
JavaScript events:

<p>Here is a paragraph with some <span class="magic"
onmouseover="this.style.color='#ffc';this.style.backgroundColor='#004';"
onmouseout="this.style.color='#000';this.style.backgroundColor='#fff';"
magic text</span>.</p>

This should work in Internet Explorer 4+ and Opera 5+ assuming JavaScript
enabled, and as a bonus will work in Netscape 6+ and Opera 7+ even if
JavaScript is disabled!
 
S

some dude somewhere

YIHAAAA, Toby is tha MAN!!!!!

Thanks!

Eric



Toby A Inkster said:
The neat way to do this is to use CSS. In your style sheet, put say:

.magic:hover {
background-color: #004;
color: #FFC;
}

and then in your HTML:

<p>Here is a paragraph with some <span class="magic">magic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top