Search code examples
csssalesforcesalesforce-lightninglightning

Salesforce image resize in LWC


I am new to salesforce development. I want to display an image in LWC in salesforce. I added the image in static resource and add the line in lightning component

<img src="{Resource.Img1}" />

The image is showing in the LWC but when I add width and height to the image it disappears. How can I add width and height and how I can add css in LWC.


Solution

  • You can add inline css as below and update the height and width of your image according to your requirement.