0

Within the variable $row["title"] below, I would like the variable $find to have the following CSS:

            font-family: Georgia, "Times New Roman", Times, serif;
            font-weight: normal;
            font-size: 24px;
            color: #004284;
            background-color: #FFFF00;   

How can I do this?

Thanks in advance,

echo '<td class="sitename1search">'.$row["title"].'</td>';
John
  • 4,820
  • 21
  • 62
  • 92
  • 3
    Sorry, can you try to describe what you want another way? Variables can't have any associated CSS, only HTML elements can. – deceze Aug 24 '10 at 02:33
  • I think you're trying to emphasize (or by highlighting) the results when you search? – Manie Aug 24 '10 at 02:36
  • 1
    If @Manie's guess is correct, I'd refer to this: http://stackoverflow.com/questions/2757556/highlight-multiple-keywords-in-search – deceze Aug 24 '10 at 02:39
  • Thanks, deceze... I used the info you link to. – John Aug 24 '10 at 03:28

1 Answers1

0

First, declare the CSS this way:

td.sitename1search span.find {
    font-family: "Georgia", "Times New Roman", "Times", serif;
    font-weight: normal;
    font-size: 24px;
    color: #004284;
    background-color: #FFFF00;   
}

Then, when you construct $row["title"], wrap the $find variable in a span like this:

$row["title"] = " ... <span class='find'>$find</span> ... ";
Timwi
  • 65,159
  • 33
  • 165
  • 230