To access elements rendered by component we need to use template property. Access element from tag. <h1>Element Inside H1 Tag </h1> const h1Element = this.template.querySelector('h1'); Console.log(h1Element.innerText ); // It will print "Element Inside H1 Tag" We can apply style sheet after getting DOM element dynamically. h1Element.style = 'color:red;border-style: solid;' Accessing element using class. const userElements = this.template.querySelectorAll('.name'); It will return node list (multiple items that is why querySelectorAll is being used.) We can set attributes to each element of node list dynamically or apply style sheet. Array . from ( userElements ). forEach ( item => { console . log ( item . innerText ); item . setAttribute ( 'title' , item . innerText ); item.style = ' background-color : ...
A place where you have to land for exploring Salesforce