QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 4752|回复: 0

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

[复制链接]

等级头衔

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

丰功伟绩

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

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。
/ M9 T$ q, J1 @3 [- i- e6 c       以下各特效用的HTML代码相同:
7 S" k2 _2 L5 y1 T8 T) Q
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>
) J! w% M* F5 j' K4 P
1. CSS动画边框: x, {3 R! z( h% t6 ~7 q
CSS代码:
0 F, v$ {+ [* O) T! j* H- 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;
}
效果如下:' N  J- H( _7 `0 R% o! b! |
1.gif
1 x: c3 U1 b+ X' }# b: {" Y0 ^0 p3 {+ n( G, z3 l/ E5 R# f) B  D, m
2. CSS图像边框7 x' w, x. G% _4 D& l
CSS代码:
& d/ o+ q- ?" m3 ]) S! l, ]
#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;
}
效果如下:
+ O/ p$ @: o' u2 m; X/ I  z 2.jpg
9 z/ ]1 J: E8 G' E3 z3 m7 I9 |
* t; `) q# p7 j7 Y( i5 i8 E$ _3.CSS蛇式边框+ |6 X1 t  Q) g2 E. D
CSS代码:
, U& I& f6 a6 U' M) w' W
#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;
}
效果如下:
6 K" f0 O8 A4 N0 S/ P 3.jpg
% d& {$ k' b1 i- ]  _7 Y
" C) ^9 T! @  ^6 C7 A- o4.CSS阶梯样式边框5 h% y! m2 i! i. I
CSS代码:
0 S* I1 \) Q- r
#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
}
效果如下:
; L/ m6 M! ^! h6 l 4.jpg * T  |2 U; v9 b6 m' O7 G: a

2 \, S7 v, k( s- f$ n' w/ {5.CSS只有阴影边框
1 L4 ^2 V5 C/ P3 y4 ?CSS代码:
  Q% W' `+ B) v6 Y6 ^: p
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 00010px white;
}
效果如下:& g. {$ {& b. J" s7 y$ d
5.jpg & T" D& d6 q( L  ]

  K3 K; u4 n2 }! s. s  ~) L1 R6.CSS带阴影和轮廓的边框3 e# A2 C6 [9 f2 N+ A& k& J( Y1 i0 t
CSS代码:
- Q" A) a! H8 _4 z
#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, r" K! A' G  E
6.jpg , X4 g" q* U" S6 h
  P: R& g  R! w/ K7 X0 a
7.CSS少量阴影和轮廓的边框6 U* K  c6 X. r2 v5 [
CSS代码:% f/ Z4 ?9 ?8 Z/ A, X) y5 y$ p( r
#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;
}
效果如下:. r: ~9 U; S( P6 m1 H' S1 d8 E8 v6 w
7.jpg
9 p0 M3 o! Z2 \$ M8 ^( H) i& @( W( j) Y
8.CSS带有阴影的双边框2 i1 Y- T) {2 d/ t
CSS代码:
) e% t+ j- i# U8 j
#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;
}
效果如下:. V# l, ^' W# s, X
8.jpg
( T! C$ Y* w3 B+ g) H( o' G, g! |) G4 _9 \6 V
9.CSS多色边框7 v5 R0 R% n  L. q- N  p. t% ~
CSS代码:
1 z# r% K$ z) v: I# V! o
#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 V7 _1 h5 q, x
9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-9-1 05:50

Powered by paopaomj X3.5 © 2016-2025 sitemap

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