ForEAch-object and IF loop not working


Need some help with the below code, looks the IF test statement does not get evaluated, don't know what i am doing wrong.  Have tried using -match -eq - like parameters still the same result

What the code should do, is to replace some HTML code to allow for me to highlight the service name

$data = Get-service -Name GoogleChromeElevationService | ConvertTo-Html -Fragment | Out-String |
ForEach-Object {
if($_ -contains "<td>GoogleChromeElevationService</td>"){
$_ -replace "<td>GoogleChromeElevationService</td>", "<td style='background-color:#00FF00'>GoogleChromeElevationService</td>"
elseif($_ -contains "<td>fail</td>"){
$_ -replace "<td>fail</td>", "<td style='background-color:#FF0000'>fail</td>"
$_ -replace "<td>off</td>", "<td style='background-color:#FFFF00'>off</td>"