Highlighting Text

Sometimes you want to highlight text to make a point or for any other purpose. The new in line STYLE attribute allows for many fun constructions. These are not fully supported in all new browsers yet, although that is changing quickly with each new release. Remember, though, that older browsers still in use will not display many of these features at all!

Here are a couple of examples with code you can easily modify for your own use. Move your mouse over and along these lines of bold text:

This is an example of changing the color of text using a MouseOver.

<B>This is an <SPAN onmouseout="this.style.color='black';" onmouseover="this.style.color='red';">example</SPAN> of changing the color of text using a MouseOver.</B>

This is an example of highlighting the background color of text using a MouseOver.

<B>This is an <SPAN onmouseout="this.style.background='';" onmouseover="this.style.background='yellow';">example</SPAN< of highlighting the background color of text using a MouseOver.</B>

Notice in the second example the onmouseout value is empty (ie: ='') which simply puts no background color behind the text and therefore lets the existing paterned background show behind the text.

It's always the right time to use good code!

[ back to main | back to top ]


Copyright © 2002 by Stephen B. Henry