<div class="menu">
<label for="menu_bar01">アコーディオン1</label>
<input type="checkbox" id="menu_bar01" />
<ul id="links01">
<li><a href="">Link01</a></li>
<li><a href="">Link02</a></li>
<li><a href="">Link03</a></li>
<li><a href="">Link04</a></li>
</ul>
<label for="menu_bar02">アコーディオン2</label>
<input type="checkbox" id="menu_bar02" />
<ul id="links02">
<li><a href="">Link01</a></li>
<li><a href="">Link02</a></li>
<li><a href="">Link03</a></li>
<li><a href="">Link04</a></li>
</ul>
</div>
.menu {
max-width: 600px;
}
.menu a {
display: block;
padding: 15px;
text-decoration: none;
color: #000;
}
label {
display: block;
margin: 0 0 4px 0;
padding : 15px;
line-height: 1;
color :#fff;
background : green;
cursor :pointer;
}
input {
display: none;
}
.menu ul {
margin: 0;
padding: 0;
background :#f4f4f4;
list-style: none;
}
.menu li {
height: 0;
overflow: hidden;
transition: all 0.5s;
transition: all 0.5s;
transition: all 0.5s;
transition: all 0.5s;
transition: all 0.5s;
}
#menu_bar01:checked ~ #links01 li,
#menu_bar02:checked ~ #links02 li {
height: 54px;
opacity: 1;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.