1、动画CSS边框

  1. <div id="box">
  2. 编程适合那些有不同想法的人... <br/>
  3. 对于那些想要创造大事物并愿意改变世界的人们。
  4. </div>
  5. <style>
  6. @keyframes animated-border {
  7. 0% {
  8. box-shadow: 0000rgba(255,255,255,0.4);
  9. }
  10. 100% {
  11. box-shadow: 00020pxrgba(255,255,255,0);
  12. }
  13. }
  14. #box {
  15. animation: animated-border 1.5s infinite;
  16. font-family: Arial;
  17. font-size: 18px;
  18. line-height: 30px;
  19. font-weight: bold;
  20. color: white;
  21. border: 2px solid;
  22. border-radius: 10px;
  23. padding: 15px;
  24. }
  25. </style>

**9个很棒的CSS边框技巧 - 图1

2、CSS图像边框

  1. <div id="box">
  2. 编程适合那些有不同想法的人... <br/>
  3. 对于那些想要创造大事物并愿意改变世界的人们。
  4. </div>
  5. <style>
  6. #box {
  7. font-family: Arial;
  8. font-size: 18px;
  9. line-height: 30px;
  10. font-weight: bold;
  11. color: white;
  12. border: 40px solid transparent;
  13. border-image: url(https://image.flaticon.com/icons/svg/648/648787.svg);
  14. border-image-slice: 100%;
  15. border-image-width: 60px;
  16. padding: 15px;
  17. }
  18. </style>

9个很棒的CSS边框技巧 - 图2

3、蛇式CSS边框

  1. <div id="box">
  2. 编程适合那些有不同想法的人... <br/>
  3. 对于那些想要创造大事物并愿意改变世界的人们。
  4. </div>
  5. <style>
  6. #box {
  7. font-family: Arial;
  8. font-size: 18px;
  9. line-height: 30px;
  10. font-weight: bold;
  11. color: white;
  12. padding: 15px;
  13. border: 10px dashed #FF5722;
  14. background:
  15. linear-gradient(to top, green, 10px, transparent 10px),
  16. linear-gradient(to right, green, 10px, transparent 10px),
  17. linear-gradient(to bottom, green, 10px, transparent 10px),
  18. linear-gradient(to left, green, 10px, transparent 10px);
  19. background-origin: border-box;
  20. }
  21. </style>

9个很棒的CSS边框技巧 - 图3

4、阶梯样式CSS边框

  1. <style>
  2. #box {
  3. font-family: Arial;
  4. font-size: 18px;
  5. line-height: 30px;
  6. font-weight: bold;
  7. color: white;
  8. padding: 40px;
  9. box-shadow:
  10. inset #0096880005px,
  11. inset #059c8e0001px,
  12. inset #0cab9c00010px,
  13. inset #1fbdae00011px,
  14. inset #8ce9ff00016px,
  15. inset #48e4d600017px,
  16. inset #e5f9f700021px,
  17. inset #bfecf700022px
  18. }
  19. </style>

9个很棒的CSS边框技巧 - 图4

5、只有阴影CSS边框

  1. #box {
  2. font-family: Arial;
  3. font-size: 18px;
  4. line-height: 30px;
  5. font-weight: bold;
  6. color: white;
  7. padding: 40px;
  8. border-radius: 10px;
  9. box-shadow: 00010px white;
  10. }

9个很棒的CSS边框技巧 - 图5

6、带阴影和轮廓的CSS边框

  1. #box {
  2. font-family: Arial;
  3. font-size: 18px;
  4. line-height: 30px;
  5. font-weight: bold;
  6. color: white;
  7. padding: 40px;
  8. box-shadow:
  9. 0001px#009688,
  10. 0005px#F44336,
  11. 0009px#673AB7,
  12. 00010px#009688;
  13. outline: dashed 10px#009688;
  14. }

9个很棒的CSS边框技巧 - 图6

7、少量阴影和轮廓

  1. #box {
  2. font-family: Arial;
  3. font-size: 18px;
  4. line-height: 30px;
  5. font-weight: bold;
  6. color: white;
  7. padding: 40px;
  8. box-shadow:
  9. 0001px#009688,
  10. 0005px#F44336,
  11. 0009px#673AB7,
  12. 00010px#009688;
  13. outline: dashed 10px#009688;
  14. }

**9个很棒的CSS边框技巧 - 图7

8、带有阴影的双CSS边框

  1. #box {
  2. font-family: Arial;
  3. font-size: 18px;
  4. line-height: 30px;
  5. font-weight: bold;
  6. color: white;
  7. padding: 40px;
  8. box-shadow: 00010px#009688;
  9. border: 10px solid #009688;
  10. outline: dashed 10px white;
  11. }

**9个很棒的CSS边框技巧 - 图8

9、多色CSS边框

  1. #box {
  2. font-family: Arial;
  3. font-size: 18px;
  4. line-height: 30px;
  5. font-weight: bold;
  6. color: white;
  7. padding: 40px;
  8. background:
  9. linear-gradient(to top, #4caf50, #4caf50 10px, transparent 10px),
  10. linear-gradient(to right, #c1ef8c, #c1ef8c 10px, transparent 10px),
  11. linear-gradient(to bottom, #8bc34a, #8bc34a 10px, transparent 10px),
  12. linear-gradient(to left, #009688, #00968810px, transparent 10px);
  13. background-origin: border-box;
  14. }

**9个很棒的CSS边框技巧 - 图9