QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 4537|回复: 0

[HTML/CSS/JS] 几个非常绚丽的CSS样式边框特效代码

[复制链接]

等级头衔

积分成就    金币 : 2861
   泡泡 : 1516
   精华 : 6
   在线时间 : 1328 小时
   最后登录 : 2026-5-15

丰功伟绩

优秀达人突出贡献荣誉管理论坛元老活跃会员

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。$ o0 \& H# I' h8 _- T3 N9 G3 s
       以下各特效用的HTML代码相同:" i$ P2 @/ F) g
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>

0 W4 l* t& @1 i7 C0 r1. CSS动画边框
8 S) J4 s% U" t. H* iCSS代码:" @2 m0 K( z" V/ t) C' }3 i0 v1 C8 x0 N
@keyframes animated-border {
  0% {
    box-shadow: 0000rgba(255,255,255,0.4);
  }
  100% {
     box-shadow: 00020pxrgba(255,255,255,0);
  }
}
#box {
  animation: animated-border 1.5s infinite;
  font-family: Arial;
  font-size: 18px;
  line-height: 30px;
  font-weight: bold;
  color: white;
  border: 2px solid;
  border-radius: 10px;
  padding: 15px;
}
效果如下:
, i; _8 z  G/ z 1.gif
4 v+ e% y  q1 j+ I" ?& @& B. L& k6 R7 P% v1 l$ T4 \
2. CSS图像边框6 O8 `. ]& K. n" {
CSS代码:9 r* K7 D7 w1 a, ~. a8 Y
#box {
    font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    border: 40px solid transparent;
    border-image: url(https://image.flaticon.com/icons/svg/648/648787.svg);
    border-image-slice: 100%;
    border-image-width: 60px;
    padding: 15px;
}
效果如下:' \0 g6 P! n' g3 y4 r) J
2.jpg
1 U8 e% |& y7 F! O' f5 B8 \: D
% T) f/ r/ s) `3 _( T3.CSS蛇式边框
1 l; a* C& a8 `' W, P. K4 w0 x" JCSS代码:0 z; P2 X- \. L; e1 B
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 15px;
    border: 10px dashed #FF5722;
    background:
    linear-gradient(to top, green, 10px, transparent 10px),
    linear-gradient(to right, green, 10px, transparent 10px),
    linear-gradient(to bottom, green, 10px, transparent 10px),
    linear-gradient(to left, green, 10px, transparent 10px);
    background-origin: border-box;
}
效果如下:
1 z9 r4 }  D4 f3 H4 i 3.jpg
7 D' q4 }5 V. D- {2 ~3 e5 @. ^5 \2 A6 y) P) t5 P: `6 A0 y
4.CSS阶梯样式边框
7 x% z7 E1 }+ E' bCSS代码:7 a9 B2 b# I4 U2 P0 a
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    box-shadow:
  inset #0096880005px,
      inset #059c8e0001px,
      inset #0cab9c00010px,
      inset #1fbdae00011px,
      inset #8ce9ff00016px,
      inset #48e4d600017px,
      inset #e5f9f700021px,
      inset #bfecf700022px
}
效果如下:, m! |4 w, a% p! Q6 b/ s
4.jpg $ p& A, a  B; L9 ^4 }
  |8 U! J$ \( N1 A
5.CSS只有阴影边框
! q" M2 P  E8 A8 }9 @- U+ ACSS代码:' Q7 R& |' Y* d. K& @2 A" C' h+ J
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 00010px white;
}
效果如下:
1 N6 b! L1 F" c. G9 H& t& }/ N' S0 _( s 5.jpg
% ~# J, D; l9 S  v) _1 p& P
4 j) C, P- Q9 h4 q) |8 u+ b8 L$ @$ e6.CSS带阴影和轮廓的边框
2 t. Q! s6 ?9 j2 J2 XCSS代码:
1 L9 j% P8 `' S) b
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    box-shadow: 00010px white;
    outline: dashed 10px#009688;
}
效果如下:' I+ O# R5 N8 @
6.jpg   F% u7 U# I* g/ n

, y& L2 s( M" V; S7.CSS少量阴影和轮廓的边框* V  P) q5 o  j9 s  g
CSS代码:
6 d' K- B2 k& S$ U* S
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    box-shadow:
      0001px#009688,
      0005px#F44336,
      0009px#673AB7,
      00010px#009688;
    outline: dashed 10px#009688;
}
效果如下:
' G! B# s8 }9 M 7.jpg # n7 s4 X5 Q7 e6 U6 P/ Z
# y7 g* n+ M' b- b
8.CSS带有阴影的双边框
% V! {2 p$ O0 M, U9 Q% o# o) C  TCSS代码:
- R# Q* W+ |( c
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    box-shadow: 00010px#009688;
    border: 10px solid #009688;
    outline: dashed 10px white;
}
效果如下:9 W7 s1 X1 ]+ u1 a; K
8.jpg
% ^0 ]4 B' m3 G4 a/ v, N# u% n5 W: ]5 d
9.CSS多色边框- T$ e0 F# G: g9 F) Q; s* Z6 q
CSS代码:
8 w, l7 n5 z, O$ z$ s
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    background:
      linear-gradient(to top, #4caf50, #4caf50 10px, transparent 10px),
      linear-gradient(to right, #c1ef8c, #c1ef8c 10px, transparent 10px),
      linear-gradient(to bottom, #8bc34a, #8bc34a 10px, transparent 10px),
      linear-gradient(to left, #009688, #00968810px, transparent 10px);
  background-origin: border-box;
}
效果如下:
/ i/ g, Y6 h7 I 9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|paopaomj.COM ( 渝ICP备18007172号|渝公网安备50010502503914号 )

GMT+8, 2026-7-9 05:32

Powered by paopaomj X3.5 © 2016-2025 sitemap

快速回复 返回顶部 返回列表