<button onclick="delElement()">Delete</button>
<section>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
  <div class="msg">Hellow, world!!</div>
</section>
button { 
  padding: 10px; 
  font-family: monospace;
  font-size: 2rem;
}

section { 
  display:flex; 
  flex-direction: column; 
  justify-content: space-around;
  height: auto;
  padding: 10px;
}

.msg {
  width: 95%;
  padding: 15px;
  margin: auto;
  border: thin solid #feba02;
  background-color: #ffcc2f;
  font-size: 0.9rem;
}
/* Функция удаления элементов */
function delElement() {
  var elem = document.getElementsByClassName("msg")[0];
  var parent = elem.parentElement;
  
  parent.removeChild(elem);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.