← 一覧へ

Accordion / 014 — ボーダーレス|Borderless Simple

デザイン見本

  • Clean borderless design
  • Simple plus/minus icon
  • No visual clutter

枠線を一切使用しないボーダーレスデザイン。 コンテンツの境界を控えめにし、すっきりとした印象を与えます。余白を重視するレイアウトに適しています。

実装コード

HTML
<div class="container">
    <div class="btn-box">
        <button data-default-text="Borderless Simple Accordion" data-open-text="Close">Borderless Simple Accordion</button>
    </div>
    <div class="more">
        <ul>
            <li>Clean borderless design</li>
            <li>Simple plus/minus icon</li>
            <li>No visual clutter</li>
        </ul>
    </div>
</div>
CSS
/* アニメーション定義 */
@keyframes acc14-fadeIn {
    0% {
        opacity: 0;
        transform: translateY(-5px)
    }
    100% {
        opacity: 1;
        transform: translateY(0)
    }
}

.container {
    width: 100%;
}

.container .btn-box button {
    width: 100%;
    padding: 14px 0;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    position: relative;
}

.container .btn-box button::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 300;
    color: #666;
    transition: all 0.3s;
}

.container .btn-box button:hover {
    color: #000;
}

.container .more {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: transparent;
}

.container .more.appear {
    max-height: 200px;
    animation: acc14-fadeIn 0.3s ease;
}

.container:has(.more.appear) .btn-box button::after {
    content: '−';
    color: #000;
}

.container .more ul {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.container .more li {
    padding: 6px 0;
    color: #666;
    font-size: 13px;
}
JS
document.addEventListener("DOMContentLoaded", () => {
    document.querySelectorAll('.container').forEach(container => {
        const button = container.querySelector('.btn-box button');
        const content = container.querySelector('.more');
        
        if (button && content) {
            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;
                }
            });
        }
    });
});