1 2 3 4 5 6
| <body> <a href="#">button</a> <a href="#">button</a> <a href="#">button</a>
</body>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| html, body { width: 100%; height: 100%; background-color: #000; display: flex; flex-direction: column; justify-content: center; align-items: center; }
a { text-decoration: none; font-size: 20px; margin: 20px; padding: 10px 20px; text-transform: uppercase; transition: 0.5s; position: relative; color: #21ebff; overflow: hidden; }
a:hover::before { width: 100%; height: 100%; transition-delay: 0s; }
a:hover::after { width: 100%; height: 100%; transition-delay: 0s; }
a::before { content: ''; position: absolute; top: 0; left: 0; width: 10px; height: 10px; border-top: 1px solid #21ebff; border-left: 1px solid #21ebff; transition: 0.5s; transition-delay: 0.5s; }
a::after { content: ''; position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; border-right: 1px solid #21ebff; border-bottom: 1px solid #21ebff; transition: 0.5s; transition-delay: 0.5s; }
a:hover { background: #21ebff; color: #000; box-shadow: 0 0 50px #21ebff; transition-delay: 0.5s; }
a:nth-child(1) { filter: hue-rotate(115deg); }
a:nth-child(3) { filter: hue-rotate(270deg); }
|
tips:
filter:hue-rotate() 色调旋转滤镜 单位支持deg(0~360deg)以及其他css单位 。好处是省代码,不用重复设置border,color和bg的颜色,不兼容IE,Edge13+支持,其他浏览器支持