HTML Cookbook Basic HTML Course

It's Easy!

CSS Step By Step

Alternate Version

Highlighter Effect

In lesson 9, we learned how to use background images for a page, a div and in a paragraph. We also learned that WebTV does not support a background-image in a span, but we can use a background-color in a span.


Example

To get a background color behind a word or a phrase, we can use:
<span style="background-color:#888888">text</span>

This sentence has highlighted text.


Making a highlighter class

I like this effect so I made some "highlighter" classes in my stylesheet:

stylesheet
/* highlighters */
.hlgray {background-color:#888888}
.hlyellow {background-color:#ccbb00}
.hlblue {background-color:#3333bb}
.hlgreen {background-color:#00bb00}

Now I can use a highlighter class anywhere I want a highlighter effect.

page code
<span style="hlyellow">highlighted text</span>

This sentence has highlighted text.

This sentence has highlighted text.

This sentence has highlighted text.

This sentence has highlighted text.

Happy coding!
Gnubee

Links
Tips
Tools
References
Rules
HTML Help Gnubee - Newsgroup
HTML Course Contents (Home)

Valid XHTML 1.0!

Valid CSS!