This example shows the use of slice when the element's width is greater than its height. It presents three variations, with three different alignment values: xMidYMin, xMidYMid, and xMidYMax.
<svg viewBox="-1 -1 202 57" xmlns="http://www.w3.org/2000/svg">
<defs>
<path
id="smiley"
d="M50,10 A40,40,1,1,1,50,90 A40,40,1,1,1,50,10 M30,40 Q36,35,42,40 M58,40 Q64,35,70,40 M30,60 Q50,75,70,60 Q50,75,30,60" />
</defs>
</svg>
<rect x="0" y="15" width="60" height="30">
<title>xMidYMin slice</title>
</rect>
<svg
viewBox="0 0 100 100"
width="60"
height="30"
preserveAspectRatio="xMidYMin slice"
x="0"
y="15">
<use href="#smiley" />
</svg>
<rect x="70" y="15" width="60" height="30">
<title>xMidYMid slice</title>
</rect>
<svg
viewBox="0 0 100 100"
width="60"
height="30"
preserveAspectRatio="xMidYMid slice"
x="70"
y="15">
<use href="#smiley" />
</svg>
<rect x="140" y="15" width="60" height="30">
<title>xMidYMax slice</title>
</rect>
<svg
viewBox="0 0 100 100"
width="60"
height="30"
preserveAspectRatio="xMidYMax slice"
x="140"
y="15">
<use href="#smiley" />
</svg>
</svg>
path {
fill: yellow;
stroke: black;
stroke-width: 8px;
stroke-linecap: round;
stroke-linejoin: round;
pointer-events: none;
}
rect:hover,
rect:active {
outline: 1px solid red;
}