<button onclick="addElement()">Add new element</button>
<section></section>
button { 
  padding: 10px; 
  font-family: monospace;
  font-size: 2rem;
}

section { 
  display:flex; 
  flex-direction: column; 
  justify-content: space-around;
}

.msg {
  width: 95%;
  padding: 15px;
  margin: auto;
  border: thin solid #feba02;
  background-color: #ffcc2f;
  font-size: 0.9rem;
}
/* Функция добавления узла в DOM */
function addElement() {
  var newMessage = document.createElement("div");//создали элемент, но практически пустой
  newMessage.className = "msg";//указли ему класс CSS свойств
  newMessage.innerHTML = "Hello, world!!";//занесли текс
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.