css styling not working for some reason
hey. Basically I need to style all the img elements in my html with this:
# Define the image style CSS rule (using single quotes to avoid escaping characters)
$imageStyle = 'img { max-width: 100%; height: auto; }'
# Check if there is an existing <style> tag in the HTML body
if ($htmlBody -match '<style.*?>') {
# If a <style> tag exists, append the image styling inside it
$htmlBody = $htmlBody -replace '(</style>)', "$imageStyle`$1"
} else {
# If no <style> tag exists, add a new <style> tag with the image styling at the beginning of the HTML
$htmlBody = "<style>$imageStyle</style>`n$htmlBody"
}
I am using power automate to run this script, but whenever I add this part of the code, it gives me a syntax error and I cant understand why, ChatGPT also tells me its correct
$imageStyle = 'img { max-width: 100%; height: auto; }'
Can you help me out?