线性渐变达到目标(一个角)

  1. .box{
  2. width: 200px;
  3. height: 300px;
  4. background-color: #58a;
  5. background: linear-gradient(45deg, transparent 15px, #58a 0);
  6. }

image.png

线性渐变达到目标(两个角)

  1. .box{
  2. width: 200px;
  3. height: 100px;
  4. background: #58a;
  5. background:
  6. linear-gradient(-45deg, transparent 15px, #58a 0)
  7. right,
  8. linear-gradient(45deg, transparent 15px, #655 0)
  9. left;
  10. background-size: 50% 100%;
  11. background-repeat: no-repeat;
  12. }

image.png

线性渐变达到目标(四个角)

  1. .box{
  2. width: 200px;
  3. height: 100px;
  4. background: #58a;
  5. background:
  6. linear-gradient(135deg, transparent 15px, #58a 0)
  7. top left,
  8. linear-gradient(-135deg, transparent 15px, #58a 0)
  9. top right,
  10. linear-gradient(-45deg, transparent 15px, #58a 0)
  11. bottom right,
  12. linear-gradient(45deg, transparent 15px, #58a 0)
  13. bottom left;
  14. background-size: 50% 50%;
  15. background-repeat: no-repeat;
  16. }

image.png

弧形切角

  1. background: #58a;
  2. background:
  3. radial-gradient(circle at top left,
  4. transparent 15px, #58a 0) top left,
  5. radial-gradient(circle at top right,
  6. transparent 15px, #58a 0) top right,
  7. radial-gradient(circle at bottom right,
  8. transparent 15px, #58a 0) bottom right,
  9. radial-gradient(circle at bottom left,
  10. transparent 15px, #58a 0) bottom left;
  11. background-size: 50% 50%;
  12. background-repeat: no-repeat

image.png