
Code: Select all
img.fit
{
--border-width : 10px;
max-width: 100%;
max-height: 100%;
position : absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: cyan;
outline: var(--border-width) solid red;
outline-offset: calc(-1 * var(--border-width));
/* aspect-ratio : 9 / 6; */
width : 900px;
height : 600px;
object-fit: contain; /* not what I want, but close */
}Code: Select all
Test
Test
[img]https://i.sstatic.net/6DPT74BM.jpg[/img]
Mobile version