Images Flashcards
What is a “global” declaration that we often use with img elements, and for what effect?
max-width: 100% is a declaration that we often use globally. It prevents images from growing beyond their native max-size.
Why might we set an img declaration of display: block?
We might set display: block to prevent the bit of spacing beneath an image for misaligning elements on our page.
Are img elements display: inline or display: block by default?
img elements are display: inline by default.
When trying to size images for art-direction what can property can we use?
We can use object-fit with the value of cover
object-fit: cover;
What does the declaration object-fit: cover; do for us?
It allows an image to retain it’s normal proportions but crops the image to fit into the assigned width and height values. It does not deform the image in this case.
What is another way to think about how object-fit: cover affects an image?
object-fit: cover crops an image to fit the constrained sizes instead of deforming the image.
How can we influence how object-fit crops an image?
We can influence where the image is cropped by using the object-position property.
What values does the object-position property take?
It can take ordinal direction, percentages, pixels, etc.
When might we set a min-height on an image?
We might use min-height when an image can grow without breaking the layout, but shrinking is unacceptable.
How does object-fit help us with managing bloat and performance?
object-fit can allow us to use a single image in multiple formats thereby reducing the number of images needed for a layout