I am generating an HTML string for a table using Apex then passing that into a lightning web component using the @wire decorator. In my HTML file, I am using:
<lightning-formatted-rich-text value={chart.data}></lightning-formatted-rich-text>
to unescape the HTML characters. However, styles from the LWC's .css file are not being applied.
For example, if I simply hard code in the LWC .html file:
<table class="myclass" ... </table>
the CSS is correctly applied. But if I pass this code in from Apex the styling for myclass will not be applied.
lightning-formatted-rich-text
component will make that markup a part of that component and it will not be accessible by CSS in the parent. You may have to usestyle
instead.