QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 4145|回复: 0

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

[复制链接]

等级头衔

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

丰功伟绩

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

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。
" e2 F% ?0 c9 R' Z, ?/ u       以下各特效用的HTML代码相同:
2 h( ^5 r  g+ `2 s5 Q
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>
% P' ?! L5 H! y; j4 z; s5 E+ p
1. CSS动画边框& S9 X3 e% h- d  O  R3 i
CSS代码:
3 L, A) I9 u+ N  J. V
@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;
}
效果如下:
& k1 Q! ^9 g# o 1.gif ( h- o0 m+ p- O% `7 f

) s) ?0 N9 `, c9 o2. CSS图像边框
" y8 a/ K6 Q/ t/ e2 PCSS代码:; Y3 |2 P7 J' g# P7 R7 O
#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;
}
效果如下:! l. j6 J2 ]! Y& g! X5 ]
2.jpg   u- C3 O- ?7 q' ]* D

, N6 \- E1 j4 K( J3.CSS蛇式边框- H1 E- Z$ `9 v  e( J# X
CSS代码:# W& _2 o, u7 ?% g9 R, u5 Y/ Q" s
#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;
}
效果如下:3 B2 I" w5 G, d+ G
3.jpg 5 \" U0 W! X( {* M' b

$ ~2 T' B, S6 I4.CSS阶梯样式边框1 @% J6 M7 I/ V: ?$ a* S% G: S
CSS代码:
# ~- c: w9 A( F* A5 c. U# m  J1 k% x
#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
}
效果如下:
' l1 r2 c" ^6 Y/ E 4.jpg 5 Q. r0 d7 P) H
- ^/ b2 h" g5 R. o" x9 H# |
5.CSS只有阴影边框
+ d" _! R( p. Y. iCSS代码:
1 z- ?0 Y/ V) ~. T, `* R. _! y
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 00010px white;
}
效果如下:2 S& B! z4 J- O8 B" Y1 {  c
5.jpg
3 H$ E! B4 s4 A5 G1 l0 ~, Y( Q+ W, j# F) ~0 c$ [9 a7 ?
6.CSS带阴影和轮廓的边框* T. z! n) c5 O: T7 k' o, Q( k
CSS代码:
+ h- o% q2 X8 t& p. e8 [
#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;
}
效果如下:9 U9 H6 j2 R# q( z2 J
6.jpg
( R/ G; ]  Y0 z/ g& ^  \- V, r
9 l. d- Q% v& m9 e7.CSS少量阴影和轮廓的边框
2 t0 A$ x# D2 w, J) h2 v$ N" _CSS代码:5 b- X: A+ f7 I1 C' k
#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;
}
效果如下:- S( Q0 }7 A8 b, x
7.jpg
: k9 i* G: D1 s5 T. v$ f' ^5 g% c3 F: R9 O
8.CSS带有阴影的双边框+ ^8 Y' o+ N9 {2 U
CSS代码:" Q+ b7 [) S8 E2 t  x# C/ b
#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;
}
效果如下:
0 C+ x! i4 I9 d4 _/ Q; R/ U 8.jpg
  ^6 m2 A  z) b) R9 ^. U6 R
& D' J7 ]9 V) A& z3 h6 G9.CSS多色边框" V# D4 l0 x& T
CSS代码:
8 p9 D* j8 }* Z) d$ T
#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;
}
效果如下:! S4 N$ {# }" z% L# W
9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-5-20 22:34

Powered by paopaomj X3.5 © 2016-2025 sitemap

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