0

I want to fix size of any image in lightning web component , I used this code but when the image is small the image take just her size that work just if the image is to large .

How can I fixe this .

<div style="max-width:82%;">
   <img style="max-width:80%;max-height:80%;" src ={image} > 
</div>
1
  • Consider using "width" and "height" if you want small images enlarged and large images shrunk. However, note that small images may look bad if enlarged too much due to pixilation. This will also potentially distort images (lose aspect ratio).
    – Phil W
    Apr 28 at 10:26

1 Answer 1

0

The solution was using using "width" and "height" so my code is

<div style="max-width:95%;">
  <img style="max-width:85%;max-height:90%; height: 220px; width: 480px;" src={image}> 
</div>
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.