100-project-100-days-website/100_projects/75-cover-uncover-an-image/style.css

71 lines
1.1 KiB
CSS
Raw Normal View History

2023-05-07 10:48:33 +03:00
*{
margin: 0;
padding: 0;
font-family: "Montserrat", sans-serif;
box-sizing: border-box;
}
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.image-card{
width: 450px;
overflow: hidden;
position: relative;
}
.image-card img{
width: 100%;
transition: all .5s ease-in-out;
filter: blur(20px);
}
.content{
position: absolute;
top: 50%;
transform: translateY(-50%);
text-align: center;
color: #fff;
padding: 0 40px;
transition: .6s;
}
.content h3{
margin: 10px;
}
.toggle-btn{
appearance: none;
position: absolute;
bottom: 0;
color: #fff;
z-index: 1;
border-top: 1px solid #ffffff50;
padding: 20px;
margin: 0 40px;
width: calc(100% - 80px);
text-align: center;
cursor: pointer;
}
.toggle-btn::before{
content: "See Image";
transition: .3s;
font-size: 16px;
}
.toggle-btn:checked ~ img{
filter: blur(0);
}
.toggle-btn:checked::before{
content: "Cover Image";
}
.toggle-btn:checked ~ .content{
pointer-events: none;
opacity: 0;}