button {
position: relative;
border: none;
z-index: 1;
outline: none;
border-radius: 12px;
cursor: pointer;
overflow: hidden;
width: 100px;
height: 50px;
background: #333;
}
button::before {
content: '';
position: absolute;
width: 200%;
height: 200%;
background: red;
z-index: -2;
left: 50%;
top: 50%;
transform-origin: left top;
animation: rotation 2s linear infinite;
}
button::after {
content: '';
position: absolute;
--g: 2px;
width: calc(100% - var(--g) * 2);
height: calc(100% - var(--g) * 2);
background: #fff;
left: var(--g);
top: var(--g);
border-radius: inherit;
z-index: -1;
}
@keyframes rotation {
to {
transform: rotate(360deg);
}
}
按钮滚动边框
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 在项目中使用的时候,发现系统按钮并不符合我的需求,所以我把常用的按钮,按照我自己的理解,封装了一个! 供大家参考,...
- end~~~ 如有错误或观点不一致的请评论留言共同讨论,本人前端小白一枚,根据自己实际项目遇到的问题进行总结分享,...
- 通过background-image-slice将border图片切割成九宫格,四个顶点图片固定,若border长...
- android studio 下把按钮做成圆角并且按钮添加边框线,在这做一下笔记(这是在xml下作的) 首先在dr...