Image Clipping and Alignment with CSS

Full image:
128px x 128px, no clipping
syntax:
  • clip: rect(top right bottom left)
Right clipped:
clip: rect(0px 96px auto 0px)
Note:
  • The number of pixels for right and bottom are not now much should be clipped, but rather, where from the origin the clipping should start.
  • Auto is a special term for saying don't clip on this axis
Bottom clipped, Right set manually:
clip: rect(0px 128px 96px 0px)
Note:
  • You can also specify the width manually to get the result of auto
Left and Top clipped:
clip: rect(32px auto auto 32px)
Note:
  • Left and Top pixels define where along that axis clipping ends
  • Clipping really just means "don't display", hence the image is still aligned on the pre-border dimensions
Left and Top clipped, Origin reset
clip: rect(32px auto auto 32px)
top: -32px;
left: -32px;
Note:
  • To get alignment of the clipped image to the origin, you have to manually reset it's position
Pushing image out of frame
clip: rect(0px 96px auto 0px)
left: 32px;
Note:
  • To give the impression that an image is clipped by pushing it right outside the frame, the left attribute and the right rect argument must add up to 128px