QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 3972|回复: 0

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

[复制链接]

等级头衔

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

丰功伟绩

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

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。
: p/ y/ E* v% l( `" W       以下各特效用的HTML代码相同:( T9 Z- i$ B2 @' v- R5 Z8 t9 o( w
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>

8 H1 _: q/ c2 [; c* o, a/ B0 E1. CSS动画边框
- D- t" K8 a9 u8 vCSS代码:, `) d- D8 y, e+ |7 s: I
@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;
}
效果如下:
$ Q2 Q; F- x4 H- ~5 ^ 1.gif
+ f' u0 W& V8 s- ?, \; z% O2 \; G- ]( L
2. CSS图像边框# x2 e7 O4 }2 i
CSS代码:
( O3 _' f7 s; C% S# A# [% Q
#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;
}
效果如下:! e4 a( W1 v9 h; y9 O, d' f
2.jpg
8 A+ g9 p  N, M. }
# r1 }% Q: b. H2 t! H3.CSS蛇式边框9 m, a- \% n1 R6 z9 |5 M' e
CSS代码:5 g8 y6 Z3 Q5 n
#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;
}
效果如下:
& a2 q0 |: W% l/ ~' O6 X 3.jpg 5 Z0 I. D, E2 Q% n" ]

  C# e' \( y/ ^9 w6 F& D1 v4.CSS阶梯样式边框6 q# ]7 V& k8 z* Z
CSS代码:6 p! D% j: e: X! G
#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
}
效果如下:
" I2 L  s2 S" I7 m4 R4 Z/ r0 A1 Z: \ 4.jpg
( x. k! o3 N0 ~# F4 q) j: R. P6 K# e$ |3 y
5.CSS只有阴影边框
9 k/ w/ A0 N+ [+ P" X/ W7 f1 SCSS代码:2 B0 |' Y# q/ l' w
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 00010px white;
}
效果如下:
9 x. x2 j+ K+ j4 @$ y4 o! u 5.jpg ! _3 f; V% R* j( G

0 g! w( L- G( G. K$ \6.CSS带阴影和轮廓的边框
$ w5 E6 a( x7 S4 |6 r% VCSS代码:! |0 ^9 D% `; Y2 M" F  k
#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;
}
效果如下:
) w" |% F# }( I$ {& C 6.jpg 9 G3 S% x) N8 f- {/ T1 @% r
; I$ w9 d# o" x$ Z' }$ x- \+ q' c
7.CSS少量阴影和轮廓的边框+ V3 y; K7 X9 e
CSS代码:) T  K2 b1 p3 ?( ?
#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;
}
效果如下:
4 v$ j, b% `7 |( i0 y9 O8 C 7.jpg 7 V4 o+ E: }: G9 C8 P
6 T2 F0 H, b" h- w0 }
8.CSS带有阴影的双边框( r% p. P3 o+ g1 }8 j& ]
CSS代码:8 q8 e) X3 }1 S, y
#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;
}
效果如下:- z1 b( \* l4 s! V/ }
8.jpg
. E" L( B2 m. b6 _+ t3 o% H# w* a* d
9.CSS多色边框" S& d2 r0 b% K" H/ h
CSS代码:+ ^$ r% ?3 C0 h4 b- l
#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;
}
效果如下:5 a8 f. \6 i/ \- x6 f  R
9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-4-10 22:19

Powered by paopaomj X3.5 © 2016-2025 sitemap

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