There&#x27;s a way to centre variable width block elements that doesn&#x27;t depend on flexbox, which is:<p><pre><code>    .centred {
        &#x2F;* Make the element only as wide as it needs to be. *&#x2F;
        display: inline-block;
        &#x2F;* Let us apply positioning. *&#x2F;
        position: relative;
        &#x2F;* Move the left of the element to the middle of the container. *&#x2F;
        left: 50%;
        &#x2F;* Translate backwards half the width of the block, thus centring it. *&#x2F;
        transform: translateX(-50%);
    }
</code></pre>
It&#x27;s a useful bit of CSS to have around.