Animating CSS border property can result in in pretty spacey looking things. I just played around with it and stuff appeared.
The basics
The gist of this experiments is to:
- Make the border as wide as the box itself.
- Set different colors for the different borders.
- Then play with the border styles
- And animate it, of course.
.module {
border-color: #84be88 #695c83 #c87a61 #edc42c;
border-width: 100px;
box-sizing: border-box;
float: left;
height: 200px;
margin: 0 20px 20px 0;
width: 200px;
}Trigger the animation on hover:
.module:hover {
animation: border-animation 2s linear infinite;
}The border width keyframe animation looks something like this:
@keyframes border-animation {
0% {
border-width: 100px;
}
50% {
border-width: 0;
}
100% {
border-width: 100px;
}
}Borders on all sides same width
This examples uses a border on all sides of the component.
.module {
border-width: 100px;
}Borders only on left and right
.module {
border-width: 0px 100px 0px 100px;
}These can get crazy
This one is the trippiest of them all:
Conclusion
I have no idea how to use there... maybe they’re purpose is not be useful at all.