<section>
  <div><h1>My horizontally centred div</div>
</section>
section { display: flex; justify-content: center; width: 100%; }
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.