편집 요약 없음 태그: 되돌려진 기여 |
편집 요약 없음 태그: 되돌려진 기여 |
||
| 1번째 줄: | 1번째 줄: | ||
<html> | <html> | ||
<div class=" | <div class="accordion"> | ||
< | <div class="accordion-header">Section 1</div> | ||
< | <div class="accordion-content"> | ||
<div class=" | <p>Content for Section 1 goes here.</p> | ||
< | </div> | ||
<div class="accordion-header">Section 2</div> | |||
<div class="accordion-content"> | |||
<p>Content for Section 2 goes here.</p> | |||
</div> | |||
<div class="accordion-header">Section 3</div> | |||
<div class="accordion-content"> | |||
<p>Content for Section 3 goes here.</p> | |||
</div> | </div> | ||
</div> | </div> | ||
<style> | <style> | ||
. | .accordion-header { | ||
cursor: pointer; | |||
font-weight: bold; | |||
} | |||
.accordion-content { | |||
max-height: 0; | |||
overflow: hidden; | overflow: hidden; | ||
transition: height 0. | transition: max-height 0.2s ease-out; | ||
} | } | ||
. | |||
.accordion-content.active { | |||
max-height: 500px; | |||
} | } | ||
</style> | </style> | ||
<script> | <script> | ||
const accordionHeaders = document.querySelectorAll('.accordion-header'); | |||
accordionHeaders.forEach(header => { | |||
header.addEventListener('click', () => { | |||
header.nextElementSibling.classList.toggle('active'); | |||
}); | |||
}); | |||
</script> | </script> | ||
</html> | </html> | ||
2023년 2월 19일 (일) 19:04 판
Section 1
Content for Section 1 goes here.
Section 2
Content for Section 2 goes here.
Section 3
Content for Section 3 goes here.