| Learn | HTML - Images - Scaling image to fit or fill |
|---|
| Scaling image to fit or fill. Scaling to fit Means that the whole image will be visible but there may be some empty space on the sides or top and bottom if the image is not the same aspect as the canvas. The example shows the image scaled to fit. The blue on the sides is due to the fact that the image is not the same aspect as the canvas. Scaling to fill Means that the image is scaled so that all the canvas pixels will be covered by the image. If the image aspect is not the same as the canvas then some parts of the image will be clipped. The example shows the image scaled to fill. Note how the top and bottom of the image are no longer visible. Example Scale to fitExample Scale to fillThe only differance between the two functions is getting the scale. The fit uses the min fitting scale will the fill uses the max fitting scale. |
Read Article
https://develop.horje.com/learn/1434/reference