1. .picture{
  2. width: 400px;
  3. border: 1px solid red;
  4. transform: rotate(45deg);
  5. overflow: hidden;
  6. margin: 100px auto;
  7. }
  8. .picture img{
  9. max-width: 100%;
  10. transform: rotate(-45deg) scale(1.45);
  11. }

image.png

最终版本 利用clip-path属性实现

  1. img {
  2. clip-path: polygon(50% 0, 100% 50%,
  3. 50% 100%, 0 50%);
  4. transition: 1s clip-path;
  5. }
  6. img:hover {
  7. clip-path: polygon(0 0, 100% 0,
  8. 100% 100%, 0 100%);
  9. }