<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Fascinate|Nunito&display=swap" rel="stylesheet">
</head>
<body>
<h1>Accordion Slider</h1>
<div class="accordion">
<div class="box a1">
<div class="image_1">
<div class="text">
<h2>Title</h2>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Esse quaerat doloribus magni quis facere saepe</p>
</div>
</div>
</div>
<div class="box a2">
<div class="image_2">
<div class="text">
<h2>Title</h2>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Esse quaerat doloribus magni quis facere saepe</p>
</div>
</div>
</div>
<div class="box a3">
<div class="image_3">
<div class="text">
<h2>Title</h2>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Esse quaerat doloribus magni quis facere saepe</p>
</div>
</div>
</div>
<div class="box a4">
<div class="image_4">
<div class="text">
<h2>Title</h2>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Esse quaerat doloribus magni quis facere saepe</p>
</div>
</div>
</div>
<div class="box a5">
<div class="image_5">
<div class="text">
<h2>Title</h2>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Esse quaerat doloribus magni quis facere saepe</p>
</div>
</div>
</div>
</div>
</body>
</html>
html{
height: 100vh;
}
body{
padding: 0px;
margin: 0px;
background: radial-gradient(circle, rgba(251,119,63,1) 0%, rgba(252,232,70,1) 100%);
font-family: 'Nunito', sans-serif;
color: #fff;
}
h1, h2{
font-family: 'Fascinate', cursive;
}
.accordion{
max-width: 990px;
background: rgba(0,0,0,0.10);
height: 300px;
margin: 20px auto;
display: flex;
box-shadow: 0px 20px 30px rgba(0,0,0,0.47);
flex-direction: row;
cursor: pointer;
margin-bottom: 100px;
}
.box{
position: relative;
height: 100%;
flex: 1;
background-position: left;
background-size: cover;
transition: .7s;
box-shadow: 0px 20px 30px rgba(0,0,0,0.47);
}
.box:hover{
flex: 7;
height: 400px;
}
/* Background images */
.a1{
background-image: url("https://images.unsplash.com/photo-1564050988016-522e96f274c6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80");
}
.a2{
background-image: url("https://images.unsplash.com/photo-1564053933549-8b771fc3aabf?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1351&q=80");
}
.a3{
background-image: url("https://images.unsplash.com/photo-1564067886520-e1ff2767eb1a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1353&q=80");
}
.a4{
background-image: url("https://images.unsplash.com/photo-1564105389874-c94a26b6ccff?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80");
}
.a5{
background-image: url("https://images.unsplash.com/photo-1564047069572-9cc353ec7b11?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=676&q=80");
}
/* End Background images */
p{
font-weight: normal;
ffont-family: 'Nunito', sans-serif;
}
.text{
position: absolute;
bottom: 0;
opacity: 0;
padding: 10px;
}
.box:hover .text{
opacity: 1;
}
h1{
width: 300px;
text-align: center;
margin: 100px auto 20px auto;
}
@media screen and (max-width: 800px){
body{
margin: 0px;
}
.accordion{
flex-direction: column;
height: 700px;
box-shadow: none;
}
.box{
box-shadow: none;
background-position: center;
}
.box:hover{
flex: 7;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.