#Template directives - set html

2 messages · Page 1 of 1 (latest)

strong widget
#

Hello.
I have some markup defined in a json and I am displaying it in my component using the template directive "set:html".
Unfortunately I'm not being able to style it using the classes defined in the json markup. Is this not possible?

This is my example for better clarity:

JSON:

{
  "content": "<p class="text">hello world</p>"
}

Astro component:

<div set:html={content}></div>

I expected to be able to style my p tag using the "text" selector.

Cheers

trim otter