<div class="main-container">
  <h1>Yes</h1>
  <p>1</p>
  <p>2</p>
  <p>3</p>
  <p>4</p>
</div>
.main-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 80%;
  margin: 0 auto;
  text-align: center;
}

h1 {
  flex-basis: 100%;
}

p {
  flex-grow: 1;
}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.