I am learning css/scss. I would like to make a scss module and others also can use it in their app in the simplest way. I hope others just need to change id name and can use it. For example, I have a module _buttons.scss
:
.btn {
position: relative;
background: #27022d;
color: #fff;
transition: 500ms;
background-image: (linear-gradient(270deg, #8e9ac2, #42579a));
background-size: 400% 400%;
animation: TransitioningBackground 10s ease infinite;
&:hover {
background-image: (linear-gradient(to left, #2d8fe5, #d155b8));
transform: scale(1.05);
cursor: pointer;
}
// shine animation left side
&::before {
content: '';
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.5);
width: 60px;
height: 100%;
top: 0;
filter: blur(30px);
transform: translateX(-100px) skewX(-15deg);
}
// shine animation right side
&::after {
content: '';
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.2);
width: 30px;
height: 100%;
top: 0;
filter: blur(5px);
transform: translateX(-100px) skewX(-15deg);
}
&::before, &::after {
transform: translateX(300px) skewX(-15deg);
transition: 0.7s;
}
}
@keyframes TransitioningBackground {
0% {
background-position: 1% 0%;
}
50% {
background-position: 99% 100%;
}
100% {
background-position: 1% 0%;
}
}
How to wrap up everything as a function or module and be able to apply to other btn with different ID names, such as <btn id="test-me1">
?
Thank you!