Content
Documentation and examples for opting images into all kinds of behaviors.
In Tailwind, images and other replaced elements (like svg, video, canvas, and others) are display: block by default.
This helps to avoid unexpected alignment issues that you often run into using the browser default of display: inline.
If you ever need to make one of these elements inline instead of block, simply use the inline utility:
Use bg-{side} utilities to control the position of an elementβs background image.
bg-left-top
bg-top
bg-right-top
bg-left
bg-center
bg-right
bg-left-bottom
bg-bottom
bg-right-bottom
Use bg-contain to scale the background image to the outer edges without cropping or stretching.
Resize an elementβs content to cover its container using object-cover.
Resize an elementβs content to stay contained within its container using object-contain.
Stretch an elementβs content to fit its container using object-fill.
Display an elementβs content at its original size but scale it down to fit its container if necessary using object-scale-down.
Display an elementβs content at its original size ignoring the container size using object-none.
Overlay image example.
Masonry example with overlay.