QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 4581|回复: 0

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

[复制链接]

等级头衔

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

丰功伟绩

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

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。
- v0 ^& s1 o0 L* J4 c! \       以下各特效用的HTML代码相同:  O( \6 s2 r9 K% N; }  \7 q
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>

2 E. \9 D' E& g4 T. @5 x1. CSS动画边框
$ W" V8 s" v5 E" F8 I% i; r: {CSS代码:. N+ |% z+ f3 Z
@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;
}
效果如下:
# z8 ?, H5 `) h2 W 1.gif
/ k! e6 y# Z6 h3 X$ A  V# c9 u4 B5 M) m+ D
2. CSS图像边框
  Q" j1 J) t$ Q( H; D" d/ b! eCSS代码:
, F* I7 L- c; @+ J/ ~5 `( b; c
#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;
}
效果如下:
8 h1 D$ c2 w( y# C 2.jpg ' o! D3 m2 u" j6 a$ D9 k2 S
, ?4 k$ T7 p" ?4 K
3.CSS蛇式边框
, x% e# S/ t" M) x0 `# z$ bCSS代码:
* E, g' t3 `1 O6 {: e
#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;
}
效果如下:4 y- v5 ~/ N$ w
3.jpg % R5 I9 C; s- y. P6 u9 [
9 \6 Q% v; p. U' O
4.CSS阶梯样式边框
+ l) ?8 G8 ^( ~1 P  b% YCSS代码:
' Z- b: Y2 s6 P6 `# E
#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
}
效果如下:  ^3 `4 f2 ^' p" @
4.jpg   W* J! o& S$ v

1 a: O& O4 i( o6 ~: M! e# f$ k6 {5.CSS只有阴影边框
9 m9 U4 m/ H0 bCSS代码:  I- v! p$ D) x* \7 S! o
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 00010px white;
}
效果如下:( x; \8 ?) u. q+ {6 {3 `4 ^, ?
5.jpg
4 v1 h/ ~" e+ H3 f( K; i/ t
* A; t3 t) `/ t, s6.CSS带阴影和轮廓的边框
' x8 o! j+ W' e- [* i8 l+ ~CSS代码:. P% A" r/ b7 u  Z& r4 l
#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;
}
效果如下:) z2 f2 H% |4 x& f& ]
6.jpg * K8 V  }9 P0 j! |4 c
6 H& k9 ~/ ]' l8 l5 ~9 s
7.CSS少量阴影和轮廓的边框& U/ u2 d( p+ }5 q9 t9 s
CSS代码:
' l1 @1 b7 x7 n* `9 f
#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;
}
效果如下:. ]# k$ x  [2 k/ ^% c6 x
7.jpg
0 Z* v- I' C, q7 S) [) V, I& M9 K4 ~0 ~( r* Y
8.CSS带有阴影的双边框( f  @1 v& P/ L+ U, v9 h1 t
CSS代码:
7 D: R' X6 u. c. _) E
#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;
}
效果如下:: H4 L0 j/ F- R. n; v& A8 I
8.jpg
- U4 d! V3 G: T( s) ^3 S5 h- y! q. G" g6 w% O* P/ S$ r7 ?- `; e% R
9.CSS多色边框
) c0 m, O, V7 w: y% NCSS代码:& w2 Z( a$ d8 b1 B! R
#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;
}
效果如下:
0 @7 ]$ J4 p" T( |5 P! I+ O 9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-7-15 12:13

Powered by paopaomj X3.5 © 2016-2025 sitemap

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