QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 3248|回复: 0

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

[复制链接]

等级头衔

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

丰功伟绩

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

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。( f3 E- l; g& f- q3 L. T
       以下各特效用的HTML代码相同:5 [( i7 G: Q, e; Z" I: p! P- C1 t
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>
! J0 r3 a# o$ i! C6 c0 x
1. CSS动画边框
. J2 S+ c8 J9 A6 g! J5 LCSS代码:; c" q5 M+ [# _1 h1 s/ 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;
}
效果如下:
/ |8 {3 L; \3 H+ `- | 1.gif
' {9 E1 U. L* e6 @7 e& d% x& Z3 Y; g% J' R2 {4 B4 r2 ~7 m  A& O  y
2. CSS图像边框' J+ x8 s3 d4 ^: q
CSS代码:
; 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;
}
效果如下:- x: p/ h9 o4 M7 ]2 T. G
2.jpg * c& z+ w7 C$ M3 C+ C
( t, z- |% @$ i( L8 R
3.CSS蛇式边框3 Z7 O# x/ h1 @* H6 L6 `
CSS代码:, M2 N1 T8 D6 U, r6 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;
}
效果如下:+ x! G0 B/ V9 V6 M2 F
3.jpg 6 m; V* O- O2 h  @

$ s' W- b( Q3 v& ]- K5 @4.CSS阶梯样式边框1 d5 T1 Y% A3 S( J" \# J, J
CSS代码:
/ L1 X, `, D) g' O
#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
}
效果如下:8 F" t) ]; @6 m
4.jpg
) X9 Z3 N! ]3 J9 a3 X" c4 t
! y7 k: j4 j/ t5.CSS只有阴影边框  r# K  W8 _6 X, {: H' C
CSS代码:
8 m, }2 t; B' M* E: @: F
#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, C3 b  T3 v$ @; c 5.jpg ! Q# F& q. z) o1 C9 T) a( G: O( e
. {- t  T0 [6 f  M9 v2 _7 r
6.CSS带阴影和轮廓的边框
8 \- f2 H5 `2 hCSS代码:8 w, V5 Q% K# d9 x( `" u2 h# D: y
#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;
}
效果如下:% a+ U# D# V4 w
6.jpg
2 I: D8 T( c4 o/ b: t5 u& h3 F) c" E3 r
7 W" R6 W+ w) @, N: L; \# ]. L& R7.CSS少量阴影和轮廓的边框# C& u6 D% x" w; A9 f9 o
CSS代码:2 x' `) G  X" 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;
}
效果如下:
$ i  ~0 J* I1 ^0 h! V! | 7.jpg 0 v8 C$ h8 \* H; R& C
# y$ k! h2 g2 A0 c8 p0 T
8.CSS带有阴影的双边框7 K" a6 E- ~1 r" \
CSS代码:1 x) R. h) \/ q: d# a# O* u
#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;
}
效果如下:
) j# n; y8 P" s) k* n/ g- s 8.jpg
1 M3 I0 N1 O7 [' Z+ `- W
& v. N* U3 F* M9.CSS多色边框4 T& h5 O% U% f7 A
CSS代码:
. K6 k, e- M9 B% D2 Q
#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;
}
效果如下:/ O# G# Z5 A3 d: `, L7 v
9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-7-11 19:41

Powered by paopaomj X3.5 © 2016-2025 sitemap

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