Following are the ways we can apply in CSS in LWC. 1. Inline CCS Inline CSS is not recommended approaches, it is take highest priority among all CSS. style="color:green;font-size:10px;" is inline CSS added to div < template > < lightning-card title = "Inline CSS" > < div > < div style = "color:green;font-size:10px;" > This is inline Style div </ div > </ div > </ lightning-card > </ template > 2. External CSS style can be applied to an elements such as h1, p,div span etc. It can applied to class using "." notation. for example .user{} It can also be applied to pseudo class. for example .user:hover{} Id locator is not being used in LWC to apply style To apply external css, need to create separate CSS file, file name should be exactly matched with component name. for example - If component name is ...
A place where you have to land for exploring Salesforce
Comments