2

i'm styling a React component with css modules. there's a part where i insert html code using dangerouslySetInnerHTML

<div className={styles.article_text} dangerouslySetInnerHTML={{__html: props.text}} />

i have no control over this html code but i want to style it. i can style the html by using tag rules like this:

.article_text {
  h2 {
    @apply text-3xl mt-6 mb-4; /* this is applied to headings ... */
  }

  p {
    @apply mb-3; /* and paragraphs */
  }
  ...

what's not working is styling css classes this way:

.article_text {
  .listblock {
    @apply bg-white; /* this doesnt apply to the div.listblock inside the html code*/
  }

is there a way i can get this to work?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.