<div class="box">
  Hello world.
</div>
<div class="box">
  I'm Tom.
</div>
.box{
  margin: 10px;
  background: pink;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  margin: 0 auto;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.