Adding ,
newDiv1Text += "<span class='highlightRed'>" + div1TextSplitted[wordNumber1] + "</span> ";
span class is not applying the css class to the text.
but ,
newDiv1Text += "<span style = 'background-color :red'>" + div1TextSplitted[wordNumber1] + "</span> ";
is working .
I need the css to be applied to the text by not hardcoding. Please share your inputs
1 answer
You can dynamically change style using getter setter
https://salesforcediaries.com/2020/02/20/dynamic-css-in-lightning-web-component/