- 缝边效果
.box{
width:400px;
height: 200px;
margin: 20px;
outline: 1px white dashed;
outline-offset:-10px;
background:#f90;
}
微信截图_20221126150627.png
- 蚂蚁线
.box{
width:400px;
height: 200px;
margin: 100px;
border: 2px solid transparent;
background: linear-gradient(white,white) padding-box,repeating-linear-gradient(-45deg, black 0, black 25%, white 0, white 50%) 0/.6em .6em;
animation:ants 12s linear infinite;
}
@keyframes ants{100%{background-position:100%;}}
还有一种蚂蚁线
.box {
width: 300px;
height: 200px;
background: linear-gradient(90deg, #03a9f4 50%, transparent 0) repeat-x,
linear-gradient(90deg, #03a9f4 50%, transparent 0) repeat-x,
linear-gradient(0deg, #03a9f4 50%, transparent 0) repeat-y,
linear-gradient(0deg, #03a9f4 50%, transparent 0) repeat-y;
background-size: 8px 1px, 8px 1px, 1px 8px, 1px 8px;
background-position: 0 0, 0 100%, 0 0, 100% 0;
animation: linearBox 0.5s infinite linear;
}
@keyframes linearBox {
100% {
background-position: 6% 0, -6% 100%, 0 -6%, 100% 6%;
}
}
@keyframes linearBox {
100% {
background-position: 6% 0, -6% 100%, 0 -6%, 100% 6%;
}
}
微信截图_20221126151144.png
- 信封边框
++ 背景渐变
.box{
width:400px;
height: 200px;
margin: 100px;
padding:1em;
border: 1em solid transparent;
background: linear-gradient(white,white) padding-box,repeating-linear-gradient(-45deg, red 0, red 12.5%, transparent 0, transparent 25%, #58a 0, #58a 37.5%, transparent 0, transparent 50%) 0/5em 5em;
}
++ 边框图片
.box{
width:400px;
height: 200px;
margin: 100px;
padding:1em;
border: 1em solid transparent;
border-image:repeating-linear-gradient(-45deg, red 0, red 1em, transparent 0, transparent 2em, #58a 0, #58a 3em, transparent 0, transparent 4em) 16;
}
微信截图_20221126151532.png
- 脚注效果
.box{
width:400px;
height: 200px;
margin: 100px;
//由于使用了currentColor,它会根据color属性的变化而自动适应
padding-top:1em;
border-top: .2em solid transparent;
border-image: 100% 0 0 linear-gradient(90deg,currentColor 4em,transparent 0);
}
微信截图_20221126152207.png
原贴地址
网友评论