<img>
is a replaced element; it has a display
value of inline
by default, but its default dimensions are defined by the embedded image’s intrinsic values, like it were inline-block
. You can set properties like border
/border-radius
, padding
/margin
, width
, height
, etc. on an image.
<img>
has no baseline, so when images are used in an inline formatting context with vertical-align
: baseline
, the bottom of the image will be placed on the text baseline.
You can use the object-position
property to position the image within the element’s box, and the object-fit
property to adjust the sizing of the image within the box (for example, whether the image should fit the box or fill it even if clipping is required).
Depending on its type, an image may have an intrinsic width and height. For some image types, however, intrinsic dimensions are unnecessary. SVG images, for instance, have no intrinsic dimensions if their root <svg>
element doesn’t have a width
or height
set on it.