JSFiddle - React, Tailwind, and code Playground

HTML

<h4>
  <span style="background-color:coral;">Überschrift 1</span>
  <span style="background-color:lightblue;">Überschrift 2</span>
</h4>

CSS

h4 {
    width: 500px;
    margin:5%;
    height: 300px;
    border: 1px solid #999;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-align-content: center;
    align-content: center;
}

h4 span {
    width:100%;
    text-align:center;
    padding:8px 12px;
}