css fit code example Example 1: css width fit to content width: fit-content; Example 2: css image cover object-fit: contain;