アコーディオン:ミニマリスト|Accordion: Minimalist
- Clean and minimal design
- Subtle animations
- Focus on typography
- Elegant transitions
- Professional appearance
HTML
<div class="container">
<div class="btn-box">
<button data-default-text="Minimalist Accordion" data-open-text="Close">Minimalist Accordion</button>
</div>
<div class="more">
<ul>
<li>Clean and minimal design</li>
<li>Subtle animations</li>
<li>Focus on typography</li>
<li>Elegant transitions</li>
<li>Professional appearance</li>
</ul>
</div>
</div>
CSS
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #ffffff;
padding: 20px;
min-height: 100vh;
color: #333;
}
.container {
margin-bottom: 30px;
max-width: 600px;
margin-left: auto;
margin-right: auto;
position: relative;
}
@keyframes minimalFadeIn {
0% {
opacity: 0;
transform: translateY(-5px);
}
100% {
opacity: 1;
transform: none;
}
}
@keyframes underlineExpand {
0% {
width: 0;
}
100% {
width: 100%;
}
}
.container .btn-box button {
width: 100%;
padding: 20px 0;
background: transparent;
border: none;
border-bottom: 1px solid #e0e0e0;
font-size: 18px;
font-weight: 400;
color: #333;
cursor: pointer;
transition: all 0.3s ease;
text-align: left;
position: relative;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
letter-spacing: -0.02em;
}
.container .btn-box button::before {
content: '';
position: absolute;
bottom: -1px;
left: 0;
height: 2px;
background: #333;
transition: width 0.3s ease;
width: 0;
}
.container .btn-box button::after {
content: '+';
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
font-size: 24px;
font-weight: 300;
color: #666;
transition: all 0.3s ease;
}
.container .btn-box button:hover {
color: #000;
}
.container .btn-box button:hover::before {
width: 100%;
}
.container .btn-box button:hover::after {
color: #000;
}
.container .more {
max-height: 0;
overflow: hidden;
transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
background: transparent;
}
.container .more.appear {
max-height: 400px;
animation: minimalFadeIn 0.3s ease;
}
.container:has(.more.appear) .btn-box button::after {
transform: translateY(-50%) rotate(45deg);
color: #000;
}
.container .more ul {
list-style: none;
padding: 20px 0;
margin: 0;
}
.container .more li {
padding: 12px 0;
color: #666;
font-size: 15px;
line-height: 1.6;
border-bottom: 1px solid #f5f5f5;
font-weight: 300;
transition: all 0.2s ease;
}
.container .more li:hover {
color: #333;
padding-left: 5px;
}
.container .more li:last-child {
border-bottom: none;
}
/* レスポンシブ対応 */
@media (max-width: 768px) {
.container .btn-box button {
font-size: 16px;
padding: 15px 0;
}
.container .more ul {
padding: 15px 0;
}
.container .more.appear {
max-height: 300px;
}
.container .more li {
font-size: 14px;
padding: 10px 0;
}
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
const button = document.querySelector('.btn-box button');
const content = document.querySelector('.more');
button.addEventListener('click', function() {
content.classList.toggle('appear');
// ボタンテキストの切り替え
if (content.classList.contains('appear')) {
this.textContent = this.dataset.openText || 'Close';
} else {
this.textContent = this.dataset.defaultText;
}
});
});