Conteúdo do Curso
CSS Fundamentals
CSS Fundamentals
Working with Images
We know that images play a crucial role on a web page. It helps to show the content effectively and clearly. Sometimes, the content image may have a size that is either bigger or smaller than the container it is intended to be displayed in, or its aspect ratio may be different from that of the container. We will consider how to show an image in the best manner.
object-fit
object-fit
specifies how an image should be resized to fit its container.
fill
stretches the image to fill the container, regardless of its aspect ratio. This may cause the image to be cropped or distorted;contain
scales the image to fit the container while preserving its aspect ratio. This may result in empty space around the image if the container and the image have different aspect ratios;cover
scales the image to completely cover the container while preserving its aspect ratio;none
displays the image at its original size, regardless of the size of the container. This may cause the image to overflow the container;scale-down
scales the image down to fit the container if it is larger than the image's natural size, or displays the image at its natural size if it fits within the container.
index
index
index
object-position
object-position
specifies the position of the image inside its container. It accepts two values: a horizontal value and a vertical value or we can use reserved words.
index
index
index
Obrigado pelo seu feedback!