<button class="accordion">Вопрос 1</button>
<div class="panel">
  <p>Ответ на Вопрос 1...</p>
</div>

<button class="accordion">Вопрос 2</button>
<div class="panel">
  <p>Ответ на Вопрос 2...</p>
</div>

<button class="accordion">Вопрос  3</button>
<div class="panel">
  <p>Ответ на Вопрос 3 ...</p>
</div>
.accordion {
    background-color: #CFD8DC;
    color: #fff;
    cursor: pointer;
    padding: 16px;
    width: 50%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 18px;
    transition: 0.5s;
}

.active, .accordion:hover {
    background-color: #607D8B;
}

.accordion:after {
    content: '\002B';
    color: #fff;
  font-size: 18px;
    font-weight: bold;
    float: right;
    margin-left: 5px;
}

.active:after {
    content: "\2212";
}

.panel {
    padding: 0 18px;
  color: #212121;
    background-color: #fff;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    this.classList.toggle("active");
    var panel = this.nextElementSibling;
    if (panel.style.maxHeight){
      panel.style.maxHeight = null;
    } else {
      panel.style.maxHeight = panel.scrollHeight + "px";
    } 
  });
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.