QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

查看: 3736|回复: 0

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

[复制链接]

等级头衔

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

丰功伟绩

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

联系方式
发表于 2020-7-6 13:32:58 | 显示全部楼层 |阅读模式
       CSS 样式是边框最重要的一个方面,这不是因为样式控制着边框的显示(当然,样式确实控制着边框的显示),而是因为如果没有样式,将根本没有边框。* y* K! K' B9 ?  u+ H
       以下各特效用的HTML代码相同:( }1 _! g8 w, u4 R1 ~7 t
<div id="box">
  编程适合那些有不同想法的人... <br/>
  对于那些想要创造大事物并愿意改变世界的人们。
</div>
3 o+ b1 ]$ ]& z3 q
1. CSS动画边框
( z1 S9 M2 `* V! b  NCSS代码:3 Y- L3 w2 ~$ c1 g/ E' S
@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;
}
效果如下:% l8 g1 d1 T! ^( `* x, C6 u( t: c% `
1.gif
- {7 `/ d. ^0 j8 t& w& l4 o+ o! R8 B) u$ K' L$ Z
2. CSS图像边框0 S# b/ I. F7 S6 d$ H
CSS代码:. j% ]7 y$ X9 x9 r6 i$ j  l% U
#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;
}
效果如下:% ^/ S- p. \3 Y0 S; m
2.jpg & x% i( b) d; D  ?, a) u) `" j
( a7 D" i7 H2 X( y% O  H6 K# T
3.CSS蛇式边框
. X/ ]* x- P' A; U4 `; ~CSS代码:
6 b9 g# |9 T) D/ x1 L
#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;
}
效果如下:+ n7 v; t. |6 C+ q8 f
3.jpg % h3 Q5 {. Y: B7 ~$ g% D8 m
5 L  P: F4 X0 X; Y+ s1 S+ d: t* x
4.CSS阶梯样式边框
. f+ c9 B* e+ |1 A) |2 [CSS代码:
2 O7 x7 P# Y% q
#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
}
效果如下:
( o) R% y: A& z 4.jpg
& w% u; @6 |! @# S# f
5 ]) x. o* U- T7 q# n( p% x$ u5.CSS只有阴影边框% F1 V2 w9 v- Q/ e' W" i& @- G7 @' I- C
CSS代码:
# e, C2 q/ L5 a7 G9 D
#box {
  font-family: Arial;
    font-size: 18px;
    line-height: 30px;
    font-weight: bold;
    color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 00010px white;
}
效果如下:
5 x3 A& x- b9 {: T 5.jpg % t2 Z! d' l" K8 {4 `8 ]- V$ P

! s+ _+ o! c9 R, F- h; ]* f6.CSS带阴影和轮廓的边框
7 S3 R5 M* m# ~0 A* F! CCSS代码:
, Z9 b/ l/ p% v1 n, T
#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 d" h3 {" G. ]) J( o4 H9 J 6.jpg
/ y" c4 G) W/ t; @+ G5 ?# O+ J* m  M
  b3 {$ w8 h% d' \0 v7.CSS少量阴影和轮廓的边框! ?7 c' y: W. y" z" ?7 Y
CSS代码:
$ s6 f) Y- l# f2 v' ^0 h4 x
#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;
}
效果如下:
/ e5 s/ p3 j2 a/ A$ b# a6 Q% R 7.jpg
# z4 u0 M' ~4 R, Q! Z2 l1 N
/ \6 Q, J! w* d8 }8.CSS带有阴影的双边框+ N5 K7 T9 m% }( m  z
CSS代码:
' l6 i: `3 v8 P% ?+ S7 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;
}
效果如下:4 S# G; U! r4 [" [
8.jpg
( r* B& I8 |& S/ P  h! x7 [3 k2 ?' ]5 p# h$ I: W# R: m2 h1 j
9.CSS多色边框
- m9 N2 _% ^/ y; |( gCSS代码:
7 o6 N3 P3 U. a3 {4 V* k
#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;
}
效果如下:+ }& T' b# u+ F: Z, ~0 n' a# n
9.jpg
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-14 02:18

Powered by paopaomj X3.5 © 2016-2025 sitemap

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