i have a button with shadow around. The shadow is in an extra class.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: consolas;
min-height: 100%;
}
body {
font-family: 'Anonymous Pro', monospace;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #C7DEFA;
position: relative;
}
.btn {
position: relative;
width: 66px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
right: -500px;
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 10px;
height: 100%;
background: linear-gradient(#fff, #fff, #F9FCFF);
z-index: 1;
filter: blur(1px);
}
.btn::after {
content: '';
position: absolute;
top: 0;
right: -1px;
width: 10px;
height: 100%;
background: #9CA6B1;
z-index: 1;
filter: blur(1px);
}
.btn-after {
position: relative;
width: 100%;
height: 100%;
border: none;
padding: 10px 25px;
outline: none;
background: linear-gradient(#D8E8FC, #B2C2D5);
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1), 15px 15px 15px rgba(0, 0, 0, 0.1), 20px 20px 15px rgba(0, 0, 0, 0.1), 30px 30px 15px rgba(0, 0, 0, 0.1), inset 1px 1px 2px #fff;
}
.shadow {
position: absolute;
top: 0;
left: -50px;
width: calc(100% + 50px);
height: 300px;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent, transparent);
transform-origin: top;
transform: skew(45deg);
pointer-events: none;
}
.shadow::before {
content: '';
position: absolute;
width: 50px;
height: 50px;
background: #C7DEFA;
z-index: 1;
}
<body>
<div class="btn">
<div class="shadow"></div>
<a href="#" class="btn-after"></a>
</div>
</body>
What I need help with is, to disable the .shadow class while btn:active. So there would be no shadow if the btn is clicked. It should look like a keyboard button with shadow when not clicked and without shadow when clicked.
Thx alot!