Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to invert text (white on black) using tags?

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Hi,

I need to be able to highlight passages of text in an HTML document, like you'd see if you did a search on a particular word within a webpage; all the matching words would be inverted (white on black).

What do I need to add to my stylesheet in order to achieve this, and what do I put either side of the text that I want to highlight (I'm thick so explain it clearly)?

Thanks,

- Andy.
 
Hi mate,

Try the following..

In the head tag..

<style>
.text1 {
COLOR: #FFFFFF;
TEXT-DECORATION: none;
background: #000000;
font-family: verdana,arial;
font-size: 9pt;
font-weight: bold;
}
</style>

Wherever you want the text..

<span class=&quot;text1&quot;>This is text</span>

Hope this helps Wullie

 
Hi Andy,

Here is an example how to do this.
I put the style in the <head>, but if you have a CSS you ca ad the style there

<HTML>
<HEAD>
<TITLE>black white example</TITLE>

<style>
.bw {
background-color: black;
color:white;
}
</style>

</HEAD>
<BODY >
just a peace of text 1 <span class=&quot;bw&quot;>and another peace of a text 2 background black</span> and this is text 3 <span class=&quot;bw&quot;>and just a text 4 </span>and just a text 5


</BODY>
</HTML> <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Yes, LOL and press the 'submit' also at the same time LOL <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top