Skip to main content

BoxFit

The fit property supports the following values:

ValueDescription
fillStretches the child to fill the box, distorting the aspect ratio if necessary.
containScales the child to fit within the box while maintaining its aspect ratio.
coverScales the child to completely cover the box, possibly cropping parts of it.
fitWidthScales the child to match the width of the box, possibly overflowing vertically.
fitHeightScales the child to match the height of the box, possibly overflowing horizontally.
nonePositions the child without scaling, potentially allowing it to overflow the box.
scaleDownScales the child down to fit within the box only if it is larger than the box.

Example JSON​

{
"type": "fittedBox",
"fit": "contain"
}