<div class="accordion">
<div class="in">
<label>
<input type="checkbox" name="option" >
<h3>Текст 1</h3>
<div class="out">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga laborum ab expedita ex alias iusto, quas voluptas voluptatem. Exercitationem sint fugiat odit ipsa culpa aliquid numquam! Alias ipsum itaque porro.
</div>
</label>
</div>
<div class="in">
<label>
<input type="checkbox" name="option" >
<h3>Текст 2</h3>
<div class="out">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga laborum ab expedita ex alias iusto, quas voluptas voluptatem. Exercitationem sint fugiat odit ipsa culpa aliquid numquam! Alias ipsum itaque porro.
</div>
</label>
</div>
<div class="in">
<label>
<input type="checkbox" name="option">
<h3>Текст 3</h3>
<div class="out">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga laborum ab expedita ex alias iusto, quas voluptas voluptatem. Exercitationem sint fugiat odit ipsa culpa aliquid numquam! Alias ipsum itaque porro.
</div>
</label>
</div>
</div>
*{
user-select: none;
}
.accordion{
width: 500px;
margin: 40px auto;
font-family: sans-serif;
}
.in{
width: 100%;
overflow: hidden;
border: 1px solid #ccc;
border-radius: 6px;
background: #fff;
margin-top: 6px;
}
[type='checkbox']{
display: none;
}
h3{
display: inline-block;
padding: 10px;
margin: 0;
width: 100%;
font-weight: 500;
font-size: 14px;
width: 100%;
text-transform: uppercase;
}
.out{
height: 0;
transform: scaleY(0);
transition: 0.2s cubic-bezier(.2,.1,.8,1.4);
padding: 0;
margin: auto;
opacity: 0;
font-weight: 100;
font-size: 14px;
}
.out img{
display: block;
width: 100%;
margin: 16px 0;
}
input:checked ~ .out{
transform: scaleY(1);
height: auto;
opacity: 1;
padding: 30px;
}
input:checked ~ h3{
background: #fafafa;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.